joaogarin / angular-electron

Angular2 and Electron starter using webpack
150 stars 53 forks source link

Angular loadChildren routing not considered with webpack #52

Closed thardes2 closed 7 years ago

thardes2 commented 7 years ago

There is an issue, which is already closed, but not considered in your example: https://github.com/angular/angular/issues/12432

joaogarin commented 7 years ago

Hello,

You need to use ngtools/webpack or some other solution for supporting lazy loading. I will maybe add it to the repo. I will update the issue when I do that.

Nebula-Spark commented 7 years ago

@thardes2

For lazy laoding

You need to install
npm i angular2-router-loader

add Loader 'angular2-router-loader' in webpack.config

Then Just add the routing

like this

{ path: 'zombie', loadChildren: './bricks/redemption/redemption.module#RedemptionModule?sync=true' }

joaogarin commented 7 years ago

yes you can also just add @ngtools/webpack and that will take care of both lazy loading, aot and scss files as well case needed. Quite usefull. I will try to add it in the next days.