@@ -12,17 +12,27 @@ export default function() {
12
12
. then ( ( ) => ng ( 'build' ) )
13
13
. then ( ( ) => oldNumberOfFiles = readdirSync ( 'dist' ) . length )
14
14
. then ( ( ) => ng ( 'generate' , 'module' , 'lazy' , '--routing' ) )
15
+ . then ( ( ) => ng ( 'generate' , 'module' , 'too/lazy' , '--routing' ) )
15
16
. then ( ( ) => addImportToModule ( 'src/app/app.module.ts' , oneLine `
16
17
RouterModule.forRoot([{ path: "lazy", loadChildren: "app/lazy/lazy.module#LazyModule" }]),
17
- RouterModule.forRoot([{ path: "lazy1", loadChildren: "./lazy/lazy.module#LazyModule" }])
18
+ RouterModule.forRoot([{ path: "lazy1", loadChildren: "./lazy/lazy.module#LazyModule" }]),
19
+ RouterModule.forRoot([{ path: "lazy2", loadChildren: "./too/lazy/lazy.module#LazyModule" }])
18
20
` , '@angular/router' ) )
19
21
. then ( ( ) => ng ( 'build' ) )
20
- . then ( ( ) => readdirSync ( 'dist' ) . length )
21
- . then ( currentNumberOfDistFiles => {
22
+ . then ( ( ) => readdirSync ( 'dist' ) )
23
+ . then ( ( distFiles ) => {
24
+ const currentNumberOfDistFiles = distFiles . length ;
22
25
if ( oldNumberOfFiles >= currentNumberOfDistFiles ) {
23
26
throw new Error ( 'A bundle for the lazy module was not created.' ) ;
24
27
}
25
28
oldNumberOfFiles = currentNumberOfDistFiles ;
29
+
30
+ if ( ! distFiles . includes ( 'lazy.module.chunk.js' ) ) {
31
+ throw new Error ( 'The bundle for the lazy module did not have a name.' ) ;
32
+ }
33
+ if ( ! distFiles . includes ( 'lazy.module.0.chunk.js' ) ) {
34
+ throw new Error ( 'The bundle for the lazy module did not use a unique name.' ) ;
35
+ }
26
36
} )
27
37
// verify System.import still works
28
38
. then ( ( ) => writeFile ( 'src/app/lazy-file.ts' , '' ) )
0 commit comments