@@ -86,24 +86,16 @@ export const loadFile = (file: string) => {
8686 if ( file . startsWith ( 'http' ) ) {
8787 return file ;
8888 }
89- console . log ( 'Loading file:' , file ) ;
9089 let path ;
9190 let baseUrl = '' ;
9291 if ( file . startsWith ( '@/' ) ) {
93- console . log ( 'Loading from @/' ) ;
9492 path = file . replace ( '@/' , '' ) ;
95- console . log ( 'Resolved path:' , path ) ;
96- baseUrl = new URL ( `./${ path } ` , import . meta. url . split ( '?' ) [ 0 ] ) . href ;
97- console . log ( 'Base URL:' , baseUrl ) ;
93+ baseUrl = new URL ( `./${ path } ` , new URL ( import . meta. url ) . origin + new URL ( import . meta. url ) . pathname ) . href ;
9894 } else if ( file . startsWith ( '@@/' ) ) {
99- console . log ( 'Loading from @@/' ) ;
10095 path = file . replace ( '@@/' , '' ) ;
101- console . log ( 'Resolved path:' , path ) ;
102- baseUrl = new URL ( `./custom/${ path } ` , import . meta. url . split ( '?' ) [ 0 ] ) . href ;
103- console . log ( 'Base URL:' , baseUrl ) ;
96+ baseUrl = new URL ( `./${ path } ` , new URL ( import . meta. url ) . origin + new URL ( import . meta. url ) . pathname ) . href ;
10497 } else {
105- baseUrl = new URL ( `./${ file } ` , import . meta. url . split ( '?' ) [ 0 ] ) . href ;
106- console . log ( 'Loading from relative path:' , baseUrl ) ;
98+ baseUrl = new URL ( `./${ file } ` , new URL ( import . meta. url ) . origin + new URL ( import . meta. url ) . pathname ) . href ;
10799 }
108100 return baseUrl ;
109101}
0 commit comments