-
Notifications
You must be signed in to change notification settings - Fork 12k
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
fix(aot): Use the proper path when statically analyzing lazy routes. #2992
Conversation
2f598e1
to
4ef9f1c
Compare
7acdbc3
to
3739374
Compare
I noticed that I can have a lazy loaded module routed using relative path in the main app routes file, but if the lazy loaded module itself wanted to lazy load another module, it can only do it using a Like: In
While in
Is this what the PR fixes? |
(the above code lives in https://github.com/Meligy/routing-angular-cli/tree/deep-lazy-loading) |
f82d568
to
51e87ae
Compare
So, should we expect lazy loading to work properly with AoT in next release? Even for large project (without Heep Errors angular/angular#12184)? |
Before, we were using paths relative to base at all time, but these might not be the paths we get in System.import(), therefore we have to keep the relative path. Also fix e2e tests. BREAKING CHANGES: Using relative paths might lead to path clashing. We now properly output an error in this case. Fixes angular#2452 Fixes angular#2735 Fixes angular#2900
I noticed a new hidden release of It there a workaround in the meanwhile to make lazy module routes to work? |
@unsafecode the temporary workaround depends on what your problem is. If it's lazy loading and AoT, you might have to pause using AoT. If it's lazy loading at all, for example going from a lazy-loaded module (call it Example: here: https://github.com/Meligy/routing-angular-cli/blob/deep-lazy-loading/src/app/lazy/lazy-routing.module.ts#L14 If it's lazy loading at all, that should actually be working in the current release (beta.19-3), and it has been working for a while. |
@Meligy First one - I need lazy routes to work with AoT, much like how this repo offers https://github.com/antonybudianto/angular-webpack-starter Note: there's actually a bug in the build, that stucks at 95% even after emitting files, but it works. |
I know :( I have seen it intermittently on a Windows machine that has an anti-virus I cannot disable. It seems when I do several file changes saved individually (generally due to VS Code not having a nice default "Save All" keyboard key binding), it tends to hang at 92% or 94% or 96% until I save another file or restart it. Since it's very intermittent and the machines I have to test on aren't ideal, I was not able to open a proper github issue. Anyway, back to main problem... I'm afraid AoT doesn't work with lazy loading at the moment. If you choose to continue with the CLI, you'll have to stop building with |
I am facing the same issue. Already updated to the latest one (19-3) but no luck . |
After upgrading to : 1.0.0-beta.20-4 running 'ng serve --aot` shows another error |
Just for information, AOT is now working with lazy loaded modules (in angular-cli 1.0.0-beta.21) ! See #2452 |
HTH, I set up a demo repo to summarize how to make lazy routes work with |
…ngular#2992) Before, we were using paths relative to base at all time, but these might not be the paths we get in System.import(), therefore we have to keep the relative path. Also fix e2e tests. BREAKING CHANGES: Using relative paths might lead to path clashing. We now properly output an error in this case. Fixes angular#2452 Fixes angular#2735 Fixes angular#2900
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. |
Before, we were using paths relative to base at all time, but these
might not be the paths we get in System.import(), therefore we have to
keep the relative path.
BREAKING CHANGES: Using relative paths might lead to path clashing. We
now properly output an error in this case.
Fixes #2452
Fixes #2735
Fixes #2900