webpack error
Hi I'm trying to use your loader but I receive in the console this kind of error:
VM6476:48 EXCEPTION: Uncaught (in promise): TypeError: __webpack_require__(...) is not a function
my webpack.config is:
rules: [
// Support for .ts files.
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader?'inlineSourceMap=true&sourceMap=false', 'angular2-load-children-loader', 'angular2-template-loader', '@angularclass/hmr-loader'],
exclude: [isTest ? /\.(e2e)\.ts$/ : /\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
},
and I use in that way:
imports: [
BrowserModule,
HttpModule,
FormsModule,
RouterModule.forRoot([
{path: '', loadChildren: './home/home.module#HomeModule'},
{path: 'about', loadChildren: './about/about.module#AboutModule'}
])],
Wbpack-version: "webpack": "^2.1.0-beta.25",
what I did wrong?
Same here, I think it's related to using also angular2-template-loader but can't confirm it right now.
I get the same error. I am using Webpack 2.2.1, and Angular 5.2.
I think the problem is because the line substituted for the sub module is:
{path: "sub", loadChildren: () => require("./sub.module")("SubModule") }
If you put that straight into your app.routing.ts, you will get the same error in the browser console.
If you use this, then it works:
{path: 'sub', loadChildren: () => require('./sub.module')['SubModule'] }
So I think the loader needs to be fixed to use square brackets [] around the sub module section, stead of () brackets.
Any chance of a fix @Quramy ?
Many thanks 👍