Closed klihelp closed 7 years ago
What version of the loader are you using ?
Sent from my iPhone
On Feb 1, 2017, at 1:57 PM, klihelp notifications@github.com wrote:
export const ROUTES: Routes = [ { path: '**', component: NoContentComponent }, ];
// Comments // { path: 'barrel', loadChildren: './+barrel#BarrelModule'}, On Build, Why processing commented line?
=====ng-router-loader ============ Importer: /../app/app.routes.ts Raw Request: loadChildren: './+barrel#BarrelModule' Replacement: loadChildren: () => System.import('/.../app/+barrel/index')
.then( (module: any) => module['BarrelModule']— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Using latest version2+.
// Comments
// { path: 'barrel', loadChildren: './+barrel#BarrelModule'},
On build:
ERROR in ./src/app/app.routes.ts
Module build failed: Error: Can't resolve './+barrel' in
at onResolved (../node_modules/enhanced-resolve/lib/Resolver.js:66:16)
Similar issue in angular aot build: Cannot determine the module for class https://github.com/angular/angular/issues/13590
Potentially on ng-router-loader: https://github.com/webpack/enhanced-resolve/issues/73
@klihelp I don't know what you are doing, but commenting out the barrel line did not yield any error and did not activate ng-router-loader
on that line, just checked it.
You are doing something wrong.
Anyway, this can't happen in version 2 since it uses AST to parse the code, so unless esprima
is broken I don't see how it happens.
Make sure you put the loader after your TS loader (so the loader gets JS code, not TS)
Also make sure you are not running @ngtools/webpack
, it won't work with ng-router-loader
Thanks for the info. Actually I am using a webpack based starter project: https://github.com/Websitescity/ng2-f6-starter
That project is a copy of AngularClass/angular2-webpack-starter
Make sure you put the loader after your TS loader (so the loader gets JS code, not TS)
The configuration in that project is not suitable for version 2.0 https://github.com/Websitescity/ng2-f6-starter/blob/master/config/webpack.common.js#L105-L117
ng-router-loader
get typescript, not js so the AST won't work.
This is the right setup: https://github.com/AngularClass/angular2-webpack-starter/blob/master/config/webpack.common.js#L119-L133
I really don't get the point of making a starter that is copy of another starter, how much knowledge is required in so many different fields to maintain that...
On Build, Why processing commented line?