@@ -638,9 +638,9 @@ export class Application implements ServerApplication {
638638 getMainJS ( bundleMode = false ) : string {
639639 const alephPkgUri = getAlephPkgUri ( )
640640 const alephPkgPath = alephPkgUri . replace ( 'https://' , '' ) . replace ( 'http://localhost:' , 'http_localhost_' )
641- const { baseUrl : baseURL , defaultLocale, framework } = this . config
641+ const { basePath : basePath , defaultLocale, framework } = this . config
642642 const config : Record < string , any > = {
643- baseURL ,
643+ basePath ,
644644 defaultLocale,
645645 locales : [ ] ,
646646 routes : this . #pageRouting. routes ,
@@ -664,13 +664,15 @@ export class Application implements ServerApplication {
664664
665665 if ( bundleMode ) {
666666 return [
667- `__ALEPH.baseURL = ${ JSON . stringify ( baseURL ) } ;` ,
667+ `__ALEPH.basePath = ${ JSON . stringify ( basePath ) } ;` ,
668668 `__ALEPH.pack["${ alephPkgUri } /framework/${ framework } /bootstrap.ts"].default(${ JSON . stringify ( config ) } );`
669669 ] . join ( '' )
670670 }
671671
672672 let code = [
673+ this . isDev && `import { connect } from "./-/${ alephPkgPath } /framework/core/hmr.js";` ,
673674 `import bootstrap from "./-/${ alephPkgPath } /framework/${ framework } /bootstrap.js";` ,
675+ this . isDev && `connect(${ JSON . stringify ( basePath ) } );` ,
674676 `bootstrap(${ JSON . stringify ( config , undefined , this . isDev ? 2 : undefined ) } );`
675677 ] . filter ( Boolean ) . join ( '\n' )
676678 this . #injects. get ( 'compilation' ) ?. forEach ( transform => {
@@ -682,9 +684,9 @@ export class Application implements ServerApplication {
682684 /** get ssr html scripts */
683685 getSSRHTMLScripts ( entryFile ?: string ) {
684686 const { framework } = this . config
685- const baseUrl = util . trimSuffix ( this . config . baseUrl , '/' )
687+ const basePath = util . trimSuffix ( this . config . basePath , '/' )
686688 const alephPkgPath = getAlephPkgUri ( ) . replace ( 'https://' , '' ) . replace ( 'http://localhost:' , 'http_localhost_' )
687- const fullAlephPkgPath = `${ baseUrl } /_aleph/-/${ alephPkgPath } `
689+ const fullAlephPkgPath = `${ basePath } /_aleph/-/${ alephPkgPath } `
688690
689691 if ( this . isDev ) {
690692 const preload : string [ ] = [
@@ -699,21 +701,21 @@ export class Application implements ServerApplication {
699701 Array . from ( this . #modules. keys ( ) ) . forEach ( url => {
700702 switch ( trimModuleExt ( url ) ) {
701703 case '/app' :
702- preload . push ( `${ baseUrl } /_aleph/app.js` )
704+ preload . push ( `${ basePath } /_aleph/app.js` )
703705 break
704706 case '/404' :
705- preload . push ( `${ baseUrl } /_aleph/404.js` )
707+ preload . push ( `${ basePath } /_aleph/404.js` )
706708 break
707709 }
708710 } )
709711
710712 if ( entryFile ) {
711- preload . push ( `${ baseUrl } /_aleph${ entryFile } ` )
713+ preload . push ( `${ basePath } /_aleph${ entryFile } ` )
712714 }
713715
714716 return [
715717 ...preload . map ( src => ( { src, type : 'module' , preload : true } ) ) ,
716- { src : `${ baseUrl } /_aleph/main.js` , type : 'module' } ,
718+ { src : `${ basePath } /_aleph/main.js` , type : 'module' } ,
717719 { src : `${ fullAlephPkgPath } /nomodule.js` , nomodule : true } ,
718720 ]
719721 }
@@ -723,7 +725,7 @@ export class Application implements ServerApplication {
723725 ...[ 'polyfill' , 'deps' , 'shared' , 'main' , entryFile ? util . trimSuffix ( entryFile , '.js' ) : '' ]
724726 . filter ( name => name !== "" && this . #bundler. getBundledFile ( name ) !== null )
725727 . map ( name => ( {
726- src : `${ baseUrl } /_aleph/${ this . #bundler. getBundledFile ( name ) } `
728+ src : `${ basePath } /_aleph/${ this . #bundler. getBundledFile ( name ) } `
727729 } ) )
728730 ]
729731 }
0 commit comments