webpack rc5 loadChildren -Error: Uncaught (in promise): TypeError: Cannot read property 'import' of undefined
See original GitHub issue- when i click the link redirecting to the lazy load path, error occurs:
browser_adapter.js:84 Error: Uncaught (in promise): TypeError: Cannot read property ‘import’ of undefined at resolvePromise (zone.js:538) at zone.js:515 at ZoneDelegate.invoke (zone.js:323) at Object.onInvoke (ng_zone_impl.js:53) at ZoneDelegate.invoke (zone.js:322) at Zone.run (zone.js:216) at zone.js:571 at ZoneDelegate.invokeTask (zone.js:356) at Object.onInvokeTask (ng_zone_impl.js:44) at ZoneDelegate.invokeTask (zone.js:355)
- my source code is:
export const routes: Routes = [ { path: ‘’, redirectTo: ‘contact’, pathMatch: ‘full’}, { path: ‘crisis’, loadChildren: ‘app/crisis/crisis.module’ }, { path: ‘heroes’, loadChildren: ‘app/hero/hero.module’ } ]; which is from https://angular.io/docs/ts/latest/guide/ngmodule.html
**everything is ok in systemjs**
- my environment is:
angular-cli: 1.0.0-beta.11-webpack.2
angular: 2.0.0-rc.5
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:19 (2 by maintainers)
Top Results From Across the Web
ERROR TypeError: Cannot read property 'loadChildren' of ...
The issue happens only when I'm in one of those new page. Here is my auth module: import { NgModule } from '@angular/core'; ......
Read more >Module Federation - webpack
This plugin adds specific references to containers as externals and allows to import remote modules from these containers. It also calls the override...
Read more >48 answers on StackOverflow to the most popular Angular ...
Angular: Can't find Promise, Map, Set and Iterator; Angular RC4 — Angular ^2.0.0 with ... EXCEPTION: TypeError: Cannot read property 'name' of null...
Read more >Router's loadChildren Callback Doesn't Have To Be A Fat ...
Webpack Performs a Static Analysis of import() Calls at Build Time ... The reason for this, as best I understand it, is that...
Read more >angular/angular - Gitter
EXCEPTION: Uncaught (in promise): Error: Cannot match any routes: '' ... @lazarljubenovic I'm getting TypeError: Cannot read property 'aa' of undefined now.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i’m trying with angular-cli from master npm linked, i’m getting the System is not defined error and adding Systemjs typings does not help (there are typings for System in src/typings.d.ts apparently), investigating… i would really like to have the lazy loading working with webpack
@Martin-Wegner I’m guessing if you add typings for System.import it will work? The PR referenced (https://github.com/angular/angular-cli/pull/1632) uses the webpack contextplugin so the existing System.imports should work for webpack as well? At least i think that’s the idea. check this for typescript support: https://github.com/TypeStrong/ts-loader/issues/129 I’m just theorizing after reading up on webpack contextplugin, i will test it when i have time :p edit: System.import only works with webpack 2.x as far as i know