-
Notifications
You must be signed in to change notification settings - Fork 12k
Lazy loaded chunk not generated when lazy route is a child of non-lazy route. #9488
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
Comments
I have the same issue +1 |
I just noticed the same issue when upgrading to angular 5.2.6 and angular/cli 1.7.1.
And then imported within Until the upgrade everything was working perfectly.
However it still works with
There is also this recent issue on stack overflow: https://stackoverflow.com/questions/48991372/angular-error-uncaught-in-promise-at-webpackasynccontext-eval-at-src |
@denyo |
@supergithubo thanks! |
+1 |
1 similar comment
+1 |
Finally solved. Im running angular/cli the cause for me was due to the fact that in app.module, I was importing a file from a barrel that was also exporting the module i was trying to lazy load. In all, make sure all the following are done:
For some reason, I had to kill node process and restart the app before angular-cli would work. |
@RyanLynnWood that did not sole the issue for me , still struggling |
@RyanLynnWood is it still fixed from a cold start, and the build folder removed? |
+1 still an issue with 1.7.2 |
Confirmed as still an issue in 1.7.2 |
Bug persists with |
Confirmed bug on cli 1.7.2. |
Confirmed bug on CLI 1.7.3. with Angular 5.2.8 |
1 similar comment
Confirmed bug on CLI 1.7.3. with Angular 5.2.8 |
restart ng server && work fine # |
The only workaround for me is to change "loadChildren" string while --watch process running. |
Angular Version: 5.2.8 Error on Lazy loading, Console: Update |
+1 I'm using ng serve --aot as a workaround |
+1 Console: |
Can confirm this is a JIT compiler issue. |
I also ran into this issue on 1.7.3. |
Actually, disregard that. I was importing my lazy-loaded module from the app's NgModule. Once I removed that import, the lazy loading worked correctly. Perhaps the error messaging itself could be improved, regardless. |
Angular Version: 5.2.9 I have same error on Lazy loading (without This seems like some issue with caching. |
It seems 'ng update' with clean 'npm i' solved this problem for me. Have no idea why. |
@benmalek3601 just tried reordering as you suggested. Same issue as before. only using --aot makes it compile correctly at this stage. At least for me, that is. |
I also had to downgrade from 1.7.3 to 1.6.8 to work around this issue. |
Hi @filipesilva ,
|
@filipesilva , I solved the problem. [IMPORTANT NOTICE]
|
I forgot to remove the Module from app.modules 🤦♂️ dont be like me |
Is this still a problem that people are experiencing with recent Angular CLI versions? |
Yes I am still having this issue . |
I was having this issue with angular-cli 8.1.3, with the (not ideal) workaround to touch Before finding that solution, I had tracked the problem down to the generated
After touching the file
|
please do not import modules (lazy modules) in app.module.ts file it'll reduce main.js file size and generates chunks as well |
@alan-agius4 Is there any more info on this ? Recently migrated to angular 7 . Lazy loading compilation in chunks is not happening for me . I have got typescripts errors as well , but that should not be linked to lazy loading compilation right ? |
I would clean the project if i were you. also put namedChunks on in the build to see if they are building correctly |
@ricardosaracino Thanks . I observed an issue right now after hours of debugging . The same issue was mentioned by @ceyhunn here in this exact thread : angular/angular#27023 (comment) . When I first try Do you @ricardosaracino or @ceyhunn have any idea as to what is causing this strange behavior and how it can be resolved ? |
@ricardosaracino Agreed . However I already have the |
There seems to be multiple reported issues in here which is hard to follow and hard to answer. That said, the original reported here should not longer be reproducible in newer versions of the Angular CLI. Please update to the most recent Angular CLI version. If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. Important to point out that Angular versions prior to 8 are no longer supported and version 8 is currently in LTS which support will terminate on the Nov 28, 2020. See https://angular.io/guide/releases#support-policy-and-schedule for more information. |
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. |
Versions
Repro steps
Observed behavior
Desired behavior
The lazy loaded route is loaded via a chunk create created by webpack
Mention any other details that might be useful (optional)
SO question raised, but nobody has an answer:
https://stackoverflow.com/questions/48523411/angular-5-with-angular-cli-non-lazy-loading-modules-in-the-router
Demo code of the exact issue on github:
https://github.com/jdcrecur/ang5ModuleRouting
The text was updated successfully, but these errors were encountered: