question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mjolkcommented, Sep 5, 2016

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

2reactions
mjolkcommented, Aug 31, 2016

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found