@@ -20,23 +20,18 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
2020
2121// set base href
2222const base :HTMLBaseElement = document . createElement ( 'base' )
23- base . href = `vscode-resource: ${ rootPath } / `
23+ base . href = `${ vscode . Uri . file ( path . join ( rootPath , 'build' ) ) . with ( { scheme : 'vscode-resource' } ) } `
2424
2525document . head . appendChild ( base )
2626
2727// used for CSP
2828const nonces :string [ ] = [ ]
2929
3030// generate vscode-resource build path uri
31- const createUri = ( filePath :string ) :any => {
32- return (
33- panel . webview
34- //@ts -ignore
35- . asWebviewUri ( vscode . Uri . file ( filePath ) )
36- . toString ( )
37- . replace ( / ^ \/ + / g, '' ) // remove leading '/'
38- . replace ( '/vscode-resource%3A' , rootPath )
39- ) // replace mangled resource path with root
31+ const createUri = ( _filePath :string ) :any => {
32+ const filePath = ( _filePath . startsWith ( 'vscode' ) ?_filePath . substr ( 16 ) :_filePath ) . replace ( '///' , '\\' )
33+
34+ return panel . webview . asWebviewUri ( vscode . Uri . file ( path . join ( rootPath , filePath ) ) )
4035}
4136
4237// fix paths for scripts
@@ -55,7 +50,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
5550runTimeScript . nonce = getNonce ( )
5651nonces . push ( runTimeScript . nonce )
5752const manifest = await import ( path . join ( rootPath , 'asset-manifest.json' ) )
58- runTimeScript . src = createUri ( path . join ( rootPath , manifest . files [ 'runtime-main.js' ] ) )
53+ runTimeScript . src = createUri ( manifest . files [ 'runtime-main.js' ] )
5954document . body . appendChild ( runTimeScript )
6055
6156// fix paths for links