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

Lazy Loading module webpack

desbond opened this issue · comments

I have tried to follow all the solutions on here to get lazy loading working with webpack. However when I add the loader to webpack.common.js There are a huge amount of errors appearing when I run npm start.

so in webpack.common.js I added
test: /\.ts$/, use: [ 'awesome-typescript-loader', { loader: 'ng-router-loader' , options: { configFileName: helpers.root('src', 'tsconfig.json') } } , 'angular2-template-loader' ]

It then says

`ERROR in ./src/app/app-routing.module.ts
Module build failed: TypeError: this.call is not a function
at Object.loader (/home/desbond/dev/angular/queue-admin/node_modules/index.ts:31:10)
@ ./src/app/app.module.ts 24:27-58
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://localhost:7070 ./src/main.ts

ERROR in [at-loader] ./node_modules/@angular/common/src/directives/ng_class.d.ts:48:34
TS2304: Cannot find name 'Set'.
`

I was also testing ng-router-loader thats why it appears above. should be angular-router-loader

ERROR in [at-loader] ./node_modules/@angular/common/src/directives/ng_class.d.ts:48:34
TS2304: Cannot find name 'Set'.

ERROR in [at-loader] ./node_modules/@angular/compiler/src/aot/compiler.d.ts:48:32
TS2304: Cannot find name 'Map'.

Got it fixed 👎
Should have been 👍
test: /\.ts$/, loaders: [ { loader: 'awesome-typescript-loader', options: { configFileName: helpers.root('src', 'tsconfig.json') } } , 'angular2-template-loader', 'angular-router-loader', ]