-
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
AOT build produces applications unable to lazy load modules #2452
Comments
#2112 seems aot process does not polished. |
I have this same issue as well. I dont have a repo to show yet but I get the same error as above.
|
I have the same problem and also don't see compiled code for the lazy modules, only the .ngfactory.ts file. |
In |
@filipesilva the same error. No changes in the main function in beta16->beta17 upgrade as I specified in #2112 (comment) |
With b17 I still don't get the lazy route modules compiled by I have a file
This route definition is part of the main route definition in
I tried changing the |
This error is also present in the demo app - webpack builds the project ok, but as soon as you click the
|
I get the error
|
Using lazy routes, v1.0.0-beta-16 wouldn't let me compile, but beta-17 completed successfully. |
Any updates on this issue? We have a large app that was originally written against beta-17. I recently moved it over to the Angular2 release and hooked up the ng compiler to take advantage of AoT compilation, but as of now I haven't found a way to leverage both AoT and lazy loading. As mentioned above, it will compile fine but when navigating to the lazy route it throws an error that 'lazy.module.ngfactory' could not be found AoT is a killer feature and made a noticeable difference in our boot time, but at this point our --prod build still send down ~2.2mb all at once and we would love to cut that down by lazy loading some of our lesser-used routes |
Same thing here, as @drejohnson is experiencing...
Created an app with
|
I just upgraded the project I tested with
|
Any update on this? |
Very strange... I've just tried This is unrelated to lazy loading (doesn't matter if I have a lazy module or not). Aot used to work just fine without lazy loading at least.
In fact, even on the same example I gave in my post above (https://github.com/MrCroft/lazy) with the same Angular version (2.1.0) and same node/cli versions, I don't get
Full logs:
Angular
Angular
Not sure what's with that |
@MrCroft transitiveModules is the options of codegen function, if options does not provided then it undefined and cause this error |
@Delagen Nobody said anything about doing anything else other than pass the |
I have created a new project using angular-cli beta.19-3 and just added a lazy route to reproduce the problem: https://github.com/sgybas/angular-cli-2452
Is there anything I can do to help resolve the issue? |
@MrCroft and @naveedahmed1, the key change was the
inside the |
I can confirm that I've just upgraded to angular-cli 1.0.0-beta.21 and lazy loading is working with AOT <3 ! Big shout out for the team :) !! |
I found a problem when running |
@maxime1992 my lazy loading works fine with Theory of Constraints in action 😉 |
Hi @tomwanzek ! Today is your lucky day :) |
HTH, I set up a demo repo to summarize how to make lazy routes work with |
I am also getting the same error of:
and also using lazy loaded modules...
Regards, Checkout the Ultimate Angular 2 Boorstrap App: @ http://ng2.javascriptninja.io |
@born2net I haven't seen that Can you open a new issue with a repo I can debug in? |
I cleared node_modules, rebuilt project and some clean ups and now gone, so ok so far |
…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
i have faced same issue but i solved it by doing following 2 things: i have added i am also using lazy loaded modules, so was exporting module class as default i removed default from
and its working for me. |
No solution??? |
This has been fixed for quite some time now. Update angular and angular
cli. Don't have to mess with the generator anymore either.
…On Wed, Aug 9, 2017, 11:27 AM IAMtheIAM ***@***.***> wrote:
No solution???
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2452 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAS3eYSr13dV5cBRaUIPMVppVJMno041ks5sWfoKgaJpZM4KLlyv>
.
|
I'm experiencing a regression with Angular 5.0.0-rc.9 and CLI v1.5.0-rc.8 |
Could you give more info?
Are you getting an error? Is it completing without issue but not lazy
loading?
One thing you do need to make sure of when lazy loading prod builds now is
to include @component({ moduleId: module.id }) in all of your components.
…On Tue, Oct 31, 2017, 9:24 PM Wilson Hobbs ***@***.***> wrote:
I'm experiencing a regression with Angular 5.0.0-rc.9 and CLI v1.5.0-rc.8
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2452 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAS3ebnrWR_YnXnxWzGSN7FkIV3qyoQbks5sx_JrgaJpZM4KLlyv>
.
|
Woah what is that @Rosseyn I have never seen the moduleId thing |
It's been around for a long while but doesn't seem to show up much in
documentation. Recently set up a new project and after enabling lazy load,
had to find this out the hard way for myself.
Does it solve the issue you're encountering?
…On Tue, Oct 31, 2017, 9:45 PM Wilson Hobbs ***@***.***> wrote:
Woah what is that @Rosseyn <https://github.com/rosseyn> I have never seen
the moduleId thing
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2452 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAS3eRBbMFmfM6nTcb4rNQPp5e8kYFbDks5sx_dOgaJpZM4KLlyv>
.
|
Hi all! Do you have any update on this issue? I've tried all workaround suggested but none of those worked for me. |
In Angular v5, what I've found is you can't terminate the file name with So if your RoutingModule is AuthRoutingModule in |
When updating to from Angular 4 to Angular 5 i kept getting
for lazy loaded modules. Removing the |
@wbhob you are my hero! was that mentioned anywhere in breaking changes??? |
I had no idea it ever worked with the extension. I've never put the extension, as far as I can remember (at least since they've moved the CLI to webpack, so way back before even ending v2 releases and moving to Angular v4 I think). |
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. |
reproduction repo can be found here
The log given by the failure.
It seems that
aot
option can not build project that lazily loads modules. I would hope that one could use the patterns in the official documentation -- which I believe I'm doing -- and use the-- aot
option to compile your app easily. I would appreciate any clarification as to whether this is an issue with theCLI
or with the compiler. Thanks.The text was updated successfully, but these errors were encountered: