@@ -18,7 +18,7 @@ export default function() {
18
18
RouterModule.forRoot([{ path: "lazy1", loadChildren: "./lazy/lazy.module#LazyModule" }]),
19
19
RouterModule.forRoot([{ path: "lazy2", loadChildren: "./too/lazy/lazy.module#LazyModule" }])
20
20
` , '@angular/router' ) )
21
- . then ( ( ) => ng ( 'build' ) )
21
+ . then ( ( ) => ng ( 'build' , '--named-chunks' ) )
22
22
. then ( ( ) => readdirSync ( 'dist' ) )
23
23
. then ( ( distFiles ) => {
24
24
const currentNumberOfDistFiles = distFiles . length ;
@@ -28,10 +28,10 @@ export default function() {
28
28
oldNumberOfFiles = currentNumberOfDistFiles ;
29
29
30
30
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.' ) ;
32
32
}
33
33
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.' ) ;
35
35
}
36
36
} )
37
37
// verify System.import still works
@@ -42,15 +42,15 @@ export default function() {
42
42
const lazyFile = 'file';
43
43
System.import('./lazy-' + lazyFile);
44
44
` ) )
45
- . then ( ( ) => ng ( 'build' ) )
45
+ . then ( ( ) => ng ( 'build' , '--named-chunks' ) )
46
46
. then ( ( ) => readdirSync ( 'dist' ) )
47
47
. then ( ( distFiles ) => {
48
48
const currentNumberOfDistFiles = distFiles . length ;
49
49
if ( oldNumberOfFiles >= currentNumberOfDistFiles ) {
50
50
throw new Error ( 'A bundle for the lazy file was not created.' ) ;
51
51
}
52
52
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.' ) ;
54
54
}
55
55
oldNumberOfFiles = currentNumberOfDistFiles ;
56
56
} )
@@ -67,6 +67,16 @@ export default function() {
67
67
throw new Error ( 'Bundles were not created after adding \'import *\'.' ) ;
68
68
}
69
69
} )
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
+ } )
70
80
// Check for AoT and lazy routes.
71
81
. then ( ( ) => ng ( 'build' , '--aot' ) )
72
82
. then ( ( ) => readdirSync ( 'dist' ) . length )
0 commit comments