New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String-based Lazy Loading is not working anymore #35652
Comments
@maxschwarzmueller, that is expected that string based lazy loaded will fail unless you amend you tsconfig to include the lazy-loaded routes. This is because otherwise the lazy-loaded files will not be part of the compilation.
It does work, but you need to opt-in this behaviour. As by default the CLI will generate projects which stricter file inclusions intended to be used with the |
I see, thank you very much for the clarification! :) Is this documented somewhere? Just asking because others might experience the same "issue". |
I don’t think there are docs for this. Transferring to the Fw repo so that we can add this until the string based lazy loading is supported. |
after angular version 8 string based lazy loading is not activated by default it is an opt in behaviour in which you have to add the lazy loaded routes in the tsconfig file for compilation. Aded a note too that it will be removed in version 11. Fixes angular#35652
after angular version 8 string based lazy loading is not activated by default it is an opt in behaviour in which you have to add the lazy loaded routes in the tsconfig file for compilation. Aded a note too that it will be removed in version 11. Fixes angular#35652
after angular version 8 string based lazy loading is not activated by default it is an opt in behaviour in which you have to add the lazy loaded routes in the tsconfig file for compilation. Aded a note too that it will be removed in version 11. Fixes angular#35652
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Is this a regression?
Yes, it worked in Angular 8.
Description
String-based lazy loading (
loadChildren: './path/to/module#Module'
) was deprecated as of Angular 8 and might be removed in Angular 11 (see: https://angular.io/guide/deprecations#index). Hence it should still work as of Angular 9.When creating new Angular projects via
ng new
, this deprecated syntax doesn't work anymore though.Instead, you get a "Cannot find module './module/....module'" error (see below).
The error is definitely related to changes made in the
tsconfig.app.json
file. (see "Minimal Reproduction").It works as intended if the
tsconfig.app.json
file usesexclude: [ ... ]
. It fails when usinginclude: [ ... ]
+files: [ ... ]
.🔬 Minimal Reproduction
See: https://github.com/maxschwarzmueller/ng-string-lazy-loading-bug/
1) Failing Case
Clone and checkout "lazy-loading-fails" branch.
ng serve
Visit localhost:4200/demo
You get the "cannot find module" error in the browser dev tools.
2) Working Case
Checkout "lazy-loading-succeeds" branch and repeat above steps => It now works.
As described above, the only difference between the two branches is the content of the
tsconfig.app.json
file (comparison: https://github.com/maxschwarzmueller/ng-string-lazy-loading-bug/compare/lazy-loading-fails...lazy-loading-succeeds?expand=1#diff-5446e8397826b1757d7b7d8f63223eab).🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: