Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
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

Description

@Maarten88

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions