using angular 7
this works for me
loadChildren = 'src/app/layout/waay/lazy.module.ts#LazyModule';
and in
angular.json
...
"lazyModules": [
"src/app/layout/waay/lazy.module.ts",
]
maybe this helps someone debugging the lazy load paths -->
(this might be subject to change in upcoming angular versions)
in chrome
now it should show you the contents of the map that angular/webpack uses to
look up the lazy routes
$_lazy_route_resource lazy namespace object (beginning of file)
var map = {
"src/app/layout/waay/lazy.module.ts": [
"./src/app/layout/waay/lazy.module.ts"
],
"src/app/pages/even/more-lazy.module.ts": [
"./src/app/pages/even/more-lazy.module.ts",
"default~src-app-pages-even-more-lazy-module-ts~src-app-pages-some-page-module-ts~sr~2cb20cb3",
"default~src-app-pages-even-more-lazy-module-ts~src-app-pages-counter-page-module~7852bff4",
"common",
"src-app-pages-even-more-lazy-module-ts"
],
"src/app/pages/too/lazy-to-be-true.module.ts": [
"./src/app/pages/too/lazy-to-be-true.module.ts",
"default~src-app-pages-too-lazy-to-be-true-module-ts~src-app-pages-some-page-modu~c179459d",
"default~src-app-pages-too-lazy-to-be-true-module-ts~src-app-pages-home-home-page-module-ts~src-app-~50ff7d88",
"default~src-app-pages-too-lazy-to-be-true-module-ts~src-app-pages-home-home-page-module-ts",
"common",
"src-app-pages-too-lazy-to-be-true-module-ts"
],
...
};
the map gives you the relation between module path and modules to be loaded for the given module path.
by looking at this map it might help you to find out why some paths couldn't be resolved.
you can also put a breakpoint in the following line to step through it via debugger and get a clear understanding of where it might fail in the lookup.
$_lazy_route_resource lazy namespace object (further down the file)
function webpackAsyncContext(req) {
var ids = map[req]; // <-- put a breakpoint there, lookup in the map happens here
if(!ids) {
return Promise.resolve().then(function() {
var e = new Error("Cannot find module '" + req + "'");
e.code = 'MODULE_NOT_FOUND';
throw e;
});
}
...
}
hope this helps someone, it did the trick for me