@@ -18,7 +18,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
1818
1919// set base href
2020const base :HTMLBaseElement = document . createElement ( 'base' )
21- base . href = panel . webview . asWebviewUri ( vscode . Uri . file ( rootPath ) ) . toString ( ) + '/'
21+ base . href = ` vscode-resource: ${ rootPath } /`
2222
2323document . head . appendChild ( base )
2424
@@ -27,10 +27,11 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
2727
2828// generate vscode-resource build path uri
2929const 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
3435}
3536
3637// fix paths for scripts