Skip to content

Commit

Permalink
fix: component preview not working on windows
Browse files Browse the repository at this point in the history
close #1737
  • Loading branch information
johnsoncodehk committed Aug 28, 2022
1 parent b0a2096 commit 471ef0e
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -133,8 +133,8 @@ export async function register(context: vscode.ExtensionContext) {
port = server.port;
}

const relativePath = path.relative(path.dirname(configFile), fileName).replace(/\\\\\\\\/g, '/');
let url = `http://localhost:${port}/__preview/${relativePath}#`;
const relativePath = shared.normalizeFileName(path.relative(path.dirname(configFile), fileName));
let url = `http://localhost:${port}/__preview${relativePath}#`;

if (lastPreviewDocument.isDirty) {
url += btoa(lastPreviewDocument.getText());
Expand Down Expand Up @@ -407,8 +407,8 @@ export async function register(context: vscode.ExtensionContext) {
}
else if (previewType === PreviewType.ExternalBrowser_Component) {
terminal.show();
const relativePath = path.relative(path.dirname(configFile), fileName).replace(/\\\\\\\\/g, '/');
panel.webview.html = getWebviewContent(`http://localhost:${port}/__preview/${relativePath}`, undefined, undefined, true);
const relativePath = shared.normalizeFileName(path.relative(path.dirname(configFile), fileName));
panel.webview.html = getWebviewContent(`http://localhost:${port}/__preview${relativePath}`, undefined, undefined, true);
externalBrowserPanel = panel;
return;
}
Expand Down

0 comments on commit 471ef0e

Please sign in to comment.