Description
🚀 feature request
Relevant Package
@angular/core
@angular/router
Angular CLI: 10.0.2
Node: 12.16.2
OS: linux x64
Angular: 10.0.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes
Package Version
@angular-devkit/architect 0.1000.2
@angular-devkit/build-angular 0.1000.2
@angular-devkit/build-ng-packagr 0.1000.2
@angular-devkit/build-optimizer 0.1000.2
@angular-devkit/build-webpack 0.1000.2
@angular-devkit/core 10.0.2
@angular-devkit/schematics 10.0.2
@angular/cli 10.0.2
@angular/fire 6.0.2
@ngtools/webpack 10.0.2
@schematics/angular 10.0.2
@schematics/update 0.1000.2
ng-packagr 10.0.1
rxjs 6.6.0
typescript 3.9.6
webpack 4.43.0
Description
I've noticed that if you have a lazy load module with guards that are included inside that lazy load module, the whole module is included in the main chunk, instead of just importing the guard service or lazy load that guard.
ie:
{
path: 'some-lazy-module',
canActivate: [CanActivateSomeLazyModuleService],
canDeactivate: [CanDeactivateSomeLazyModuleService],
loadChildren: () => import('../some/lazy/lazy.module').then(m => m.SomeLazyModule)
}
We need to make sure that some services are configured and strategies are set before the module activates and deactivates
Describe the solution you'd like
Some way of lazy load the guards of the lazy loaded module like the import function