@@ -317,7 +317,7 @@ export class SampleAssetsGenerator {
317317 }
318318 } ) ;
319319 }
320- if ( appConfig . routesConfig ?. router && appConfig . routesConfig ?. routesImportPath ) {
320+ if ( this . _shouldConfigureRouting ( config ) ) {
321321 importMap . set ( '@angular/router' , [ 'provideRouter' , 'withComponentInputBinding' ] ) ;
322322 importMap . set ( `${ appConfig . routesConfig . routesImportPath } ` , [ 'routes' ] ) ;
323323 }
@@ -355,7 +355,7 @@ export class SampleAssetsGenerator {
355355 formatted += ` ${ provider } ${ i < providers . length - 1 ? ',\n' : '' } ` ;
356356 } ) ;
357357 }
358- if ( config . appConfig . routesConfig ?. router && config . appConfig . routesConfig ?. routesImportPath ) {
358+ if ( this . _shouldConfigureRouting ( config ) ) {
359359 if ( formatted . length > 0 ) {
360360 formatted += ',\n' ;
361361 }
@@ -364,6 +364,12 @@ export class SampleAssetsGenerator {
364364 return formatted ;
365365 }
366366
367+ private _shouldConfigureRouting ( config : Config ) : boolean {
368+ return config . appConfig . routesConfig &&
369+ config . appConfig . routesConfig . router &&
370+ ! ! config . appConfig . routesConfig . routesImportPath ;
371+ }
372+
367373 private _getAppModuleConfig ( config : Config , configImports , configAdditionalImports ?) {
368374 let defaultNgDeclarations = [ "AppComponent" ] ;
369375 let defaultNgImports = [ "BrowserModule" , "BrowserAnimationsModule" , "FormsModule" ] ;
0 commit comments