@@ -77,7 +77,7 @@ function invalidPreviewMessage(middlewares: Connect.Server, msg: string) {
7777 } ) ;
7878}
7979
80- export const getViteIndexTags = ( opts : NormalizedQwikPluginOptions , srcDir : string ) => {
80+ export const getViteIndexTags = ( opts : NormalizedQwikPluginOptions , base : string ) => {
8181 const tags : HtmlTagDescriptor [ ] = [
8282 { tag : 'style' , children : qwikErrorOverlayStyles , injectTo : 'body' } ,
8383 { tag : 'style' , children : inspectorStyles , injectTo : 'body' } ,
@@ -104,13 +104,16 @@ export const getViteIndexTags = (opts: NormalizedQwikPluginOptions, srcDir: stri
104104 }
105105 if ( opts . devTools ?. clickToSource ?? true ) {
106106 const hotKeys = opts . devTools . clickToSource ?? [ ] ;
107- const srcDirUrl = new URL ( srcDir + '/' , 'http://local.local' ) . href ;
107+ // the filepaths start with /
108+ if ( base . endsWith ( '/' ) ) {
109+ base = base . slice ( 0 , - 1 ) ;
110+ }
108111 tags . push ( {
109112 tag : 'script' ,
110113 attrs : { type : 'module' } ,
111114 children : clickToComponent
112115 . replace ( 'globalThis.__HOTKEYS__' , JSON . stringify ( hotKeys ) )
113- . replace ( 'globalThis.__SRC_DIR__ ' , JSON . stringify ( srcDirUrl ) ) ,
116+ . replace ( 'globalThis.__BASE__ ' , JSON . stringify ( base ) ) ,
114117 injectTo : 'body' ,
115118 } ) ;
116119 }
0 commit comments