@@ -18,7 +18,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
18
18
19
19
// set base href
20
20
const base :HTMLBaseElement = document . createElement ( 'base' )
21
- base . href = panel . webview . asWebviewUri ( vscode . Uri . file ( rootPath ) ) . toString ( ) + '/'
21
+ base . href = ` vscode-resource: ${ rootPath } /`
22
22
23
23
document . head . appendChild ( base )
24
24
@@ -27,10 +27,11 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
27
27
28
28
// generate vscode-resource build path uri
29
29
const createUri = ( filePath :string ) :any => {
30
- return panel . webview . asWebviewUri ( vscode . Uri . file ( filePath ) )
31
- // .toString()
32
- // .replace(/^\/+/g, '') // remove leading '/'
33
- // .replace('/vscode-resource%3A', rootPath) // replace mangled resource path with root
30
+ return panel . webview
31
+ . asWebviewUri ( vscode . Uri . file ( filePath ) )
32
+ . toString ( )
33
+ . replace ( / ^ \/ + / g, '' ) // remove leading '/'
34
+ . replace ( '/vscode-resource%3A' , rootPath ) // replace mangled resource path with root
34
35
}
35
36
36
37
// fix paths for scripts