@@ -134,6 +134,7 @@ export class Appliaction {
134
134
} else if ( isRemote ) {
135
135
mod . loader = 'js'
136
136
}
137
+ this . #modules. set ( url , mod )
137
138
return mod
138
139
}
139
140
@@ -1189,10 +1190,6 @@ export class Appliaction {
1189
1190
}
1190
1191
}
1191
1192
1192
- if ( ! this . #modules. has ( url ) ) {
1193
- this . #modules. set ( url , mod )
1194
- }
1195
-
1196
1193
return mod
1197
1194
}
1198
1195
@@ -1357,24 +1354,23 @@ export class Appliaction {
1357
1354
}
1358
1355
1359
1356
// create and copy polyfill
1360
- const polyfillMod = this . newModule ( '/polyfill.js' )
1361
1357
const hash = ( new Sha1 ) . update ( buildChecksum ) . update ( AlephRuntimeCode ) . update ( `${ this . config . buildTarget } -${ VERSION } ` ) . hex ( )
1362
1358
const polyfillFile = path . join ( this . buildDir , `polyfill.bundle.${ util . shortHash ( hash ) } .js` )
1359
+ const polyfillMod = this . newModule ( '/polyfill.js' )
1360
+ polyfillMod . hash = polyfillMod . sourceHash = hash
1363
1361
if ( ! existsFileSync ( polyfillFile ) ) {
1364
1362
const rawPolyfillFile = `${ alephPkgUrl } /compiler/polyfills/${ this . config . buildTarget } /polyfill.js`
1365
1363
await this . runDenoBundle ( rawPolyfillFile , polyfillFile , AlephRuntimeCode , true )
1366
1364
}
1367
- polyfillMod . hash = polyfillMod . sourceHash = hash
1368
- this . #modules. set ( polyfillMod . url , polyfillMod )
1369
1365
log . info ( ` {} polyfill (${ this . config . buildTarget . toUpperCase ( ) } ) ${ colors . dim ( '• ' + util . formatBytes ( Deno . statSync ( polyfillFile ) . size ) ) } ` )
1370
1366
1371
- // bundle and copy page moudles
1372
- await Promise . all ( pageModules . map ( async mod => this . createPageBundle ( mod , localSharedDeps ) ) )
1373
-
1374
1367
// create main.bundle.xxxxxxxxx.js
1375
1368
const mainModule = this . getModule ( '/main.ts' ) !
1376
1369
const bundleFile = path . join ( this . buildDir , `main.bundle.${ util . shortHash ( mainModule . hash ) } .js` )
1377
1370
await Deno . copyFile ( mainModule . bundlingFile , bundleFile )
1371
+
1372
+ // bundle and copy page moudles
1373
+ await Promise . all ( pageModules . map ( async mod => this . createPageBundle ( mod , localSharedDeps ) ) )
1378
1374
}
1379
1375
1380
1376
/** create chunk bundle. */
@@ -1389,7 +1385,6 @@ export class Appliaction {
1389
1385
] : [ ]
1390
1386
}
1391
1387
} ) . flat ( ) . join ( '\n' )
1392
- const mod = this . newModule ( `/${ name } .js` )
1393
1388
const hash = ( new Sha1 ) . update ( buildChecksum ) . update ( bundlingCode ) . hex ( )
1394
1389
const bundlingFile = path . join ( this . buildDir , `${ name } .bundling.js` )
1395
1390
const bundleFile = path . join ( this . buildDir , `${ name } .bundle.${ util . shortHash ( hash ) } .js` )
@@ -1400,8 +1395,8 @@ export class Appliaction {
1400
1395
Deno . remove ( bundlingFile )
1401
1396
}
1402
1397
1398
+ const mod = this . newModule ( `/${ name } .js` )
1403
1399
mod . hash = mod . sourceHash = hash
1404
- this . #modules. set ( mod . url , mod )
1405
1400
1406
1401
log . info ( ` {} ${ name } ${ colors . dim ( '• ' + util . formatBytes ( Deno . statSync ( bundleFile ) . size ) ) } ` )
1407
1402
}
0 commit comments