brandonroberts / angular-router-loader

A Webpack loader that enables string-based module loading with the Angular Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't handle loadChildren correctly.

mrdulin opened this issue · comments

compare these two ways:

// loadChildren: loadListModule  //<- can't handle this correctly. How can I handle this?
loadChildren: './+list/list.module#ListModule?chunkName=ListModule' //<- handle correctly

+list/List.module.ts:

...
export class ListModule { }

export function loadListModule() {
  return ListModule;
}

The first way, aot is fine. But when you build with webpack and run app, the chrome console will give an error:

I ask the question here: https://stackoverflow.com/questions/45713345/angular2-runtime-compiler-is-not-loaded

Use the sync=true option for loading modules synchronously instead of lazily: https://github.com/brandonroberts/angular-router-loader#synchronous-loading

@brandonroberts ok. it that meanings my way is not support?

Yes. The sync option does what you need.

Your way won't work with AoT