Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Error after upgrading to latest webpack 2.1 beta #460

Closed
Maarten88 opened this issue Nov 24, 2016 · 1 comment
Closed

Error after upgrading to latest webpack 2.1 beta #460

Maarten88 opened this issue Nov 24, 2016 · 1 comment

Comments

@Maarten88
Copy link

In a project that uses Microsoft.AspNetCore.ReactServices I upgraded webpack to the latest beta (that I read will turn final soon) and got this error:

Exception: Call to Node module failed with error: TypeError: Cannot read property 'forEach' of undefined
at Object.addReactHotModuleReplacementBabelTransform (node_modules\aspnet-webpack-react\HotModuleReplacement.js:3:33)
at attachWebpackDevMiddleware (node_modules\aspnet-webpack\WebpackDevMiddleware.js:61:38)

this happens on the line:

app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
    HotModuleReplacement = true,
    ReactHotModuleReplacement = true
});

I think this is caused by the renaming (in webpack 2.1 beta 23) of module loaders to module rules, which I had to change in my webpack.config.

The line that causes the error is:

webpackConfig.module.loaders.forEach(function (loaderConfig) {

If I change this line to

webpackConfig.module.rules.forEach(function (loaderConfig) {

Everything seems to work as before.

@SteveSandersonMS
Copy link
Member

Thanks for reporting this!

aspnet-webpack-react version 1.0.3 is now published and includes a fix for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants