-
Notifications
You must be signed in to change notification settings - Fork 12k
Error with lazy loading modules routing : Error: Uncaught (in promise): ReferenceError: System is not defined(…) #2033
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
Known issue in older versions even mentioned in lazy loading docs. "Angular provides a built-in module loader that supports SystemJS to load modules asynchronously. If we were using another bundling tool, such as Webpack, we would use the Webpack mechanism for asynchronously loading modules." Things are supposed to improve though. There are lots of related issues in both repos and looks like it's close to working if not already working in the latest unreleased bits. Looks like angular/angular#11387 might have fixed the last missing piece but I havent tried the latest recently. Meanwhile you can see https://github.com/brandonroberts/router-cli-aot for a working example. |
Thank you @slubowsky . Now there is no error anymore, but the content of my lazy loaded modules doesn't show... |
Updated to RC7. If I use loadChildren: () => require('es6-promise!./+dashboard/dashboard.module')('DashboardModule'): It seems it doesn't like barrels... |
+1
and Angular 2 RC7 Also getting
|
The problem seems to be still present for me, even in rc7. |
@ciesielskico On webpack.9-4 it's now working for me. Initially got same error but then later on it started working. Try killing and re running ng serve after modifying your loadChildren code. Looks like perhaps webpack not repackaging everything it needs to on the initial code change. |
After changing the Route to this config:
killing ng serve and restarting it works 🎉 |
Yeah, it's working. |
Hi, Am getting the same error with Angular 2.0 with SystemJs |
Am getting the same error with Angular 2.3.0 with SystemJs ? |
Yes - problem still exist... |
Am getting the same error with Angular 2.4.9 |
ok, I guess, I found a solution webpack.server.js webpack.client.ts lazy loading + aot work well |
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. |
Ubuntu 16.04
ng --version
. If there's nothing outputted, please runin a Terminal:
node --version
and paste the result here:angular-cli: 1.0.0-beta.11-webpack.8 (From 2015/09/09 9ddba69 master branch)
node: 6.5.0
os: linux x64
do on your code? etc.
ng serve
more information.
zone.js:484Unhandled Promise rejection: System is not defined ; Zone: angular ; Task: Promise.then ; Value: ReferenceError: System is not defined(…) ReferenceError: System is not defined at SystemJsNgModuleLoader._system (http://test.local:4200/main.bundle.js:9972:49) at SystemJsNgModuleLoader.loadAndCompile (http://angular-back.lbo.local:4200/main.bundle.js:9984:25) at SystemJsNgModuleLoader.load (http://test.local:4200/main.bundle.js:9977:64) at RouterConfigLoader.loadModuleFactory (http://test.local:4200/main.bundle.js:32809:76) at RouterConfigLoader.load (http://test.local:4200/main.bundle.js:32801:52) at MergeMapSubscriber.project (http://test.local:4200/main.bundle.js:33422:82) at MergeMapSubscriber._tryNext (http://test.local:4200/main.bundle.js:38755:27) at MergeMapSubscriber._next (http://test.local:4200/main.bundle.js:38745:18) at MergeMapSubscriber.Subscriber.next (http://test.lbo.local:4200/main.bundle.js:15144:18) at ScalarObservable._subscribe (http://test.local:4200/main.bundle.js:38340:24)
Why is there a mention to SystemJs whereas i'm using angular-cli@webpack ?
The text was updated successfully, but these errors were encountered: