angular2-webpack2-lazy-children-loader
v1.0.1
Published
A webpack loader for ng2 lazy loading
Downloads
2
Readme
Angular2 load-children loader
This is a webpack loader to Angular2 lazy module loading.
It's recommended to use this loader with webpack 2.x.
- INPUT:
export const appRoutes: Routes = [
{path: "", component: MainHomeComponent},
{path: "about", component: MainAboutComponent },
{path: "sub", loadChildren: "./sub.module#SubModule" },
];
- OUTPUT:
export const appRoutes: Routes = [
{path: "", component: MainHomeComponent},
{path: "about", component: MainAboutComponent },
{path: "sub", loadChildren: () => System.import("./sub.module").then(m => m["SubModule"]) },
];
And this loader return a function to call the require
function with .ngfactory
suffix if the resource is generated by compiler-cli:
export const appRoutes: Routes = [
{path: "", component: MainHomeComponent},
{path: "about", component: MainAboutComponent },
{path: "sub", loadChildren: () => System.import("./sub.module.ngfactory").then(m => m["SubModuleNgFactory"]) },
];
Install
npm install angular2-webpack2-lazy-children-loader -D
npm install @types/node -D
or
typings install node
Notice
Fork of angular2-load-children-loader
License
MIT