@@ -43,7 +43,7 @@ export function dextPlugin(
4343 implicitlyLoadedAfterOneOf . push ( component ) ;
4444 this . emitFile ( {
4545 name : pageMap [ component ] . name . replace ( "/" , "-" ) ,
46- id : "dext-page://" + component ,
46+ id : "dext-page:/// " + component ,
4747 type : "chunk" ,
4848 } ) ;
4949 }
@@ -55,23 +55,23 @@ export function dextPlugin(
5555 } ,
5656 resolveId ( source , referrer ) {
5757 if ( referrer === "dext:///main.js" ) return source ;
58- if ( referrer ?. startsWith ( "dext-page://" ) ) {
59- return this . resolve ( source , referrer . substring ( "dext-page://" . length ) ) ;
58+ if ( referrer ?. startsWith ( "dext-page:/// " ) ) {
59+ return this . resolve ( source , referrer . substring ( "dext-page:/// " . length ) ) ;
6060 }
6161 return null ;
6262 } ,
6363 load ( id ) {
64- if ( id . startsWith ( "dext-page://" ) ) {
64+ if ( id . startsWith ( "dext-page:/// " ) ) {
6565 return `export { default } from "${
6666 id . substring (
67- "dext-page://" . length ,
67+ "dext-page:/// " . length ,
6868 )
6969 } ";`;
7070 }
7171 if ( id == "dext:///main.js" ) {
7272 const routes = Object . entries ( pageMap )
7373 . map ( ( [ id , page ] ) => {
74- return `["${ page . route } ", [() => import("dext-page://${ id } "), ${
74+ return `["${ page . route } ", [() => import("dext-page:/// ${ id } "), ${
7575 page . hasGetStaticData ? "true" : "false"
7676 } ]]`;
7777 } )
@@ -100,7 +100,7 @@ start([${routes}], App);`;
100100 const file = bundle [ name ] ;
101101 if ( file . type === "chunk" && file . isEntry ) {
102102 const component = file . facadeModuleId ! . substring (
103- "dext-page://" . length ,
103+ "dext-page:/// " . length ,
104104 ) ;
105105 const page = pageMap [ component ] ;
106106
@@ -138,8 +138,12 @@ start([${routes}], App);`;
138138 const body = options . prerender
139139 ? await prerenderPage (
140140 component ,
141- { data, route : page_ . route , path : `/${ path } ` } ,
142- { ...options , appURL } ,
141+ { data, route : page_ . route } ,
142+ {
143+ ...options ,
144+ appURL,
145+ location : `https://dext-prerender.local/${ path } ` ,
146+ } ,
143147 )
144148 : "" ;
145149
@@ -289,11 +293,11 @@ async function prerenderDocument(
289293async function prerenderPage (
290294 component : string ,
291295 context : {
292- path : string ;
293296 data : unknown ;
294297 route ?: Record < string , string | string [ ] > ;
295298 } ,
296299 options : {
300+ location : string ;
297301 tsconfigPath : string ;
298302 appURL : string ;
299303 typecheck : boolean ;
@@ -312,6 +316,8 @@ async function prerenderPage(
312316 "-q" ,
313317 "-c" ,
314318 options . tsconfigPath ,
319+ "--location" ,
320+ options . location ,
315321 ...( options . typecheck ? [ ] : [ "--no-check" ] ) ,
316322 prerenderHostURL . toString ( ) ,
317323 new URL ( `file:///${ resolvedComponent } ` ) . toString ( ) ,
0 commit comments