Skip to content

webpack/webpack-dev-server 2 throws ERROR in json.js - Parenthesized pattern #772

@aaronbeall

Description

@aaronbeall

Do you want to request a feature or report a bug?

Report an error. But it could be user error. :)

What is the current behavior?

When running webpack-dev-server I get the error:

ERROR in ./~/json3/lib/json3.js
Module parse failed: /node_modules/json3/lib/json3.js Parenthesized pattern (89:12)
You may need an appropriate loader to handle this file type.
|           if (stringifySupported) {
|             // A test function object with a custom `toJSON` method.
|             (value = function () {
|               return 1;
|             }).toJSON = value;
 @ ./~/sockjs-client/lib/main.js 7:12-28
 @ ./~/sockjs-client/lib/entry.js
 @ (webpack)-dev-server/client/socket.js
 @ (webpack)-dev-server/client?http://localhost:8080
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./main.tsx

If the current behavior is a bug, please provide the steps to reproduce.

My configuration for a React + TypeScript project:

module.exports = {
    context: __dirname + "/src",
    entry: "./main.tsx",
    output: {
        path: __dirname + "/dist",
        filename: "bundle.js"
    },
    devServer: {
     contentBase: __dirname + "/src",
    },
    devtool: "source-map",
    resolve: {
        extensions: [".tsx", ".ts", ".js"]
    },
    module: {
        loaders: [
            {
                test: /\.tsx?$/,
                loader: "ts-loader",
                exclude: /node_modules/
            }
        ]
    }
}

This config works without problems using webpack-dev-server@1 (the only config difference being "" added to extensions: ["", ".tsx", ".ts", ".js"] ).

I am not using json3 directly in code anywhere.

What is the expected behavior?

No error.

Please mention your webpack and Operating System version.

  • webpack/webpack-dev-server 2.2.1
  • OSX 10.11.4

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