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

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.

Activity

  1. SteveSandersonMS commented on Nov 25, 2016

    @SteveSandersonMS
    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 join this conversation on GitHub. Already have an account? Sign in to comment

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