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
ng serve --watch --aot and lazy loaded modules - doesn't work anymore #10822
Comments
Another variant of the error:
|
Same issue here, having to restart the serve every time is quitte cumbersome. |
Facing the same issue as @alvipeo, I feel like this need an urgent fix.
|
Yes, 6.0.3 doesn't work either.. |
Same issue here, Please find a fix for this or a workaround. |
Workaround please. I tried disabling AOT, but that results in dependency injection failing. I don't see an easy to disable router lazy loading. |
Found my temporary workaround. For dev, I disabled AOT and, as a result, had to uncomment |
Tried updating today and see if the new changes would make a difference, but I still face the same problems. My new versions look like this:
|
I too have the same issue. I tried debugging and found that some module is trying to load "./node_modules/rxjs/internal/Observable.js" But i've checked my code and no where i'm using such import statement. |
Any news on this ? It would be good to have at least an official statement about the resolution of this issue. |
Seems fixed in @angular/cli@6.0.7 |
Not for me. |
@TomDemulierChevret then aot plus lazy loading is not the only criteria. I have two repositories both with aot and lazy loading. They shows this error (crash when I change source to trigger a recompile). After my upgrade to cli607, neither repository show this problem any more. |
Can you do an And I don't know the exact source of this issue, but it definitly appeared after upgrading to Angular 6. |
Yes I am sure I start having the problem somewhere on Angular 6. Then one day one of my repos stop displaying the problem and I spent a long time finding the differences between them. My two projects are very similar in dependencies.
|
by the way, I always serve using
and if I add |
After updating, I can now use aot and optimization, without the polyfill, via the angular.json configuration. (angular.json configurations are the new way in Angular v6, rather than using --aot on the command-line.) Correction - had to keep the polyfill. 😕 |
@kernwig do you mean that if I have |
@alexfung888 , yes! angular.json is documented at https://github.com/angular/angular-cli/wiki/angular-workspace It's precise documentation, but not the most human friendly. :-( |
@kernwig your link is the same as mine. I suppose you mean I should duplicate the production branch to make a development one. |
The problem mysteriously returned. :-(
|
@kernwig What polyfill are you talking about? |
So, after a lot of debugging and trying back and forth, I finally found the issue related to the "call of undefined" error. I manage to resolve the issue by removing ALL of my parameters used when running So in my configurations object I had a property Here is my package.json file:
And my angular.json file:
As you can see, when I run Note that inside options, propery I hope this will resolve this issue for all of you. PS. For those who want to know what versions I am running, I will share my output from
|
@krilllind See my May 24th comment:
I'm using AOT again, but still that polyfill. It seems to help, but my failure is now inconsistent. You're configuration seems odd to me. My understanding is that the configuration blocks under build and serve should match up. Thus I have the build.configurations.dev:
Then serve.configurations.dev:
When running npm start, it's use the dev server configuration, which simply says to use the "dev" build configuration. ("spog" being my project name.) |
I gave up and turned off AOT in the dev configuration. :-( |
Long story short, use |
That did the trick! Anyway it takes nearly 2 seconds when nothing has changed (only assets)? |
TLDR: "commonChunk": false in your angular.json config for serve command and it may help. Have tried the upgrade, but it did not work in our case. In the end it turned out that the webpack build used under the hood is producing a common.js chunk which was never loaded (!) neither via html or dynamic import, thus the modules defined in it were missing and bootstrapping failed on first one. This resulted in the error being thrown, mentioned in the bug report (cannot invoke call of undefined) when webpack was trying to initialize a missing module. |
@banjankri where to add it? under architect/build/configurations? |
In my case I added in under architect/serve/options as I was using similar coomand to @alvipeo and did not want to affect the build, in which in my case it seems common chunk works just fine. |
Thanks for reporting this issue. This issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. 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. |
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. |
CLI 6.0.1
angular 6.0.1
Windows 10 x64
I use the following when I work on the project:
and the first time I run the project everything works. But for all subsequent changes in any file of the lazy loaded modules, the module does not load and throws the error:
etc. So I have to restart
ng serve
every time.Here's the routing config:
The text was updated successfully, but these errors were encountered: