@@ -235,23 +235,19 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
235
235
return prev ;
236
236
} , [ ] ) ;
237
237
238
- if ( globalScriptsByBundleName . length > 0 ) {
239
238
// Add a new asset for each entry.
240
- globalScriptsByBundleName . forEach ( script => {
241
- // Lazy scripts don't get a hash, otherwise they can't be loaded by name.
242
- const hash = script . inject ? hashFormat . script : '' ;
243
- const bundleName = script . bundleName ;
244
-
245
- extraPlugins . push (
246
- new ScriptsWebpackPlugin ( {
247
- name : bundleName ,
248
- sourceMap : scriptsSourceMap ,
249
- filename : `${ path . basename ( bundleName ) } ${ hash } .js` ,
250
- scripts : script . paths ,
251
- basePath : projectRoot ,
252
- } ) ,
253
- ) ;
254
- } ) ;
239
+ for ( const script of globalScriptsByBundleName ) {
240
+ // Lazy scripts don't get a hash, otherwise they can't be loaded by name.
241
+ const hash = script . inject ? hashFormat . script : '' ;
242
+ const bundleName = script . bundleName ;
243
+
244
+ extraPlugins . push ( new ScriptsWebpackPlugin ( {
245
+ name : bundleName ,
246
+ sourceMap : scriptsSourceMap ,
247
+ filename : `${ path . basename ( bundleName ) } ${ hash } .js` ,
248
+ scripts : script . paths ,
249
+ basePath : projectRoot ,
250
+ } ) ) ;
255
251
}
256
252
257
253
// process asset entries
@@ -353,12 +349,6 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
353
349
] ;
354
350
}
355
351
356
- // Allow loaders to be in a node_modules nested inside the devkit/build-angular package.
357
- // This is important in case loaders do not get hoisted.
358
- // If this file moves to another location, alter potentialNodeModules as well.
359
- const loaderNodeModules = findAllNodeModules ( __dirname , projectRoot ) ;
360
- loaderNodeModules . unshift ( 'node_modules' ) ;
361
-
362
352
const extraMinimizers = [ ] ;
363
353
if ( stylesOptimization ) {
364
354
extraMinimizers . push (
@@ -493,14 +483,20 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
493
483
} ,
494
484
resolveLoader : {
495
485
symlinks : ! buildOptions . preserveSymlinks ,
496
- modules : loaderNodeModules ,
486
+ modules : [
487
+ // Allow loaders to be in a node_modules nested inside the devkit/build-angular package.
488
+ // This is important in case loaders do not get hoisted.
489
+ // If this file moves to another location, alter potentialNodeModules as well.
490
+ 'node_modules' ,
491
+ ...findAllNodeModules ( __dirname , projectRoot ) ,
492
+ ] ,
497
493
plugins : [ PnpWebpackPlugin . moduleLoader ( module ) ] ,
498
494
} ,
499
495
context : projectRoot ,
500
496
entry : entryPoints ,
501
497
output : {
502
498
futureEmitAssets : true ,
503
- path : path . resolve ( root , buildOptions . outputPath as string ) ,
499
+ path : path . resolve ( root , buildOptions . outputPath ) ,
504
500
publicPath : buildOptions . deployUrl ,
505
501
filename : `[name]${ targetInFileName } ${ hashFormat . chunk } .js` ,
506
502
} ,
0 commit comments