@@ -18,7 +18,7 @@ export default function() {
1818 RouterModule.forRoot([{ path: "lazy1", loadChildren: "./lazy/lazy.module#LazyModule" }]),
1919 RouterModule.forRoot([{ path: "lazy2", loadChildren: "./too/lazy/lazy.module#LazyModule" }])
2020 ` , '@angular/router' ) )
21- . then ( ( ) => ng ( 'build' ) )
21+ . then ( ( ) => ng ( 'build' , '--named-chunks' ) )
2222 . then ( ( ) => readdirSync ( 'dist' ) )
2323 . then ( ( distFiles ) => {
2424 const currentNumberOfDistFiles = distFiles . length ;
@@ -28,10 +28,10 @@ export default function() {
2828 oldNumberOfFiles = currentNumberOfDistFiles ;
2929
3030 if ( ! distFiles . includes ( 'lazy.module.chunk.js' ) ) {
31- throw new Error ( 'The chunk for the lazy module did not have a name.' ) ;
31+ throw new Error ( 'The lazy module chunk did not have a name.' ) ;
3232 }
3333 if ( ! distFiles . includes ( 'lazy.module.0.chunk.js' ) ) {
34- throw new Error ( 'The chunk for the lazy module did not use a unique name.' ) ;
34+ throw new Error ( 'The lazy module chunk did not use a unique name.' ) ;
3535 }
3636 } )
3737 // verify System.import still works
@@ -42,15 +42,15 @@ export default function() {
4242 const lazyFile = 'file';
4343 System.import('./lazy-' + lazyFile);
4444 ` ) )
45- . then ( ( ) => ng ( 'build' ) )
45+ . then ( ( ) => ng ( 'build' , '--named-chunks' ) )
4646 . then ( ( ) => readdirSync ( 'dist' ) )
4747 . then ( ( distFiles ) => {
4848 const currentNumberOfDistFiles = distFiles . length ;
4949 if ( oldNumberOfFiles >= currentNumberOfDistFiles ) {
5050 throw new Error ( 'A bundle for the lazy file was not created.' ) ;
5151 }
5252 if ( ! distFiles . includes ( 'lazy-file.chunk.js' ) ) {
53- throw new Error ( 'The chunk for the lazy file did not have a name.' ) ;
53+ throw new Error ( 'The lazy file chunk did not have a name.' ) ;
5454 }
5555 oldNumberOfFiles = currentNumberOfDistFiles ;
5656 } )
@@ -67,6 +67,16 @@ export default function() {
6767 throw new Error ( 'Bundles were not created after adding \'import *\'.' ) ;
6868 }
6969 } )
70+ . then ( ( ) => ng ( 'build' , '--no-named-chunks' ) )
71+ . then ( ( ) => readdirSync ( 'dist' ) )
72+ . then ( ( distFiles ) => {
73+ if ( distFiles . includes ( 'lazy.module.chunk.js' )
74+ || distFiles . includes ( 'lazy.module.0.chunk.js' )
75+ || distFiles . includes ( 'lazy-file.chunk.js' )
76+ ) {
77+ throw new Error ( 'Lazy chunks shouldn\'t have a name but did.' ) ;
78+ }
79+ } )
7080 // Check for AoT and lazy routes.
7181 . then ( ( ) => ng ( 'build' , '--aot' ) )
7282 . then ( ( ) => readdirSync ( 'dist' ) . length )
0 commit comments