webpack-dev-server: configuration has an unknown property 'error'

Operating System: MacOS Sierra (10.12.6) Node Version: v8.6.0 NPM Version: 5.3.0 webpack Version: ^3.6.0 webpack-dev-server Version: ^2.9.1

  • This is a bug
  • This is a feature request
  • This is a modification request

Code

webpack-dev-server throws this error message:

Invalid configuration object. webpack-dev-server has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'error'. These properties are valid:
   object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, filename?, publicPath?, port?, socket?, watchOptions?, headers?, clientLogLevel?, overlay?, progress?, key?, cert?, ca?, pfx?, pfxPassphrase?, requestCert?, inline?, disableHostCheck?, public?, https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, features?, compress?, proxy?, historyApiFallback?, staticOptions?, setup?, before?, after?, stats?, reporter?, noInfo?, quiet?, serverSideRender?, index?, log?, warn? }

configuration has an unknown property ‘error’, though I don’t have any property ‘error’ in my webpack.config.js (as can be seen bellow).

webpack.config.js

const path = require('path')
const webpack = require('webpack')
const CleanWebpackPlugin = require('clean-webpack-plugin')

module.exports = {
    entry: {
        bundle: path.resolve(__dirname, 'src/index.jsx'),
    },
    output: {
        publicPath: '/',
        path: __dirname + '/dist',
        filename: '[name].[chunkhash].js',
    },
    devServer: {
        host: '0.0.0.0',
        port: 8088,
        historyApiFallback: true,
    },
    module: {
        loaders: [{
            test: /.jsx?$/,
            loader: 'babel-loader',
            exclude: /node_modules/,
            query: {
                presets: ['es2015', 'react', 'stage-0'],
                plugins: ['transform-runtime'],
            },
        }],
    },
    plugins: [
        new CleanWebpackPlugin(['dist'], {
            root: path.resolve(__dirname),
            verbrose: true,
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'commons',
        }),
    ],
}

I’d normaly say that this is a problem on my side, but I’ve double checked the configuration many times and many times removed webpack and webpack-dev-server and installed them again, but this error stays… so I suppose this may be a bug in webpack-dev-server. Strange thing is, when I run webpack, it compiles without any error and bundles everything as it’s supposed.

Expected Behavior

webpack-dev-server should compile and bundle the code and start dev server.

Actual Behavior

webpack-dev-server throws misconfiguration error.

For Bugs; How can we reproduce the behavior?

Run webpack-dev-server with the configuration snippets above.

For Features; What is the motivation and/or use-case for the feature?

EDIT:

I’m using webpack-dev-server via the CLI

EDIT 2:

Here is a simplified repo with replicated error: https://github.com/7h3w4rd0c70r/wds-misconfiguration-error

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Should be fixed by a3f7277, version 2.9.3

@lewismoten Just as @shellscape suggested above, try to start the webpack-dev-server from the npm scripts instead of directly from CLI.

"scripts": {
    "dev": "webpack-dev-server"
}

npm run dev

(Temporarily solution, until the bug is fixed.)

I had this issue too but while it’s true that if you execute the script in npm start it will work. For me that only worked if I used the Windows CLI not git Bash which is where the problem manifested itself originally for me. If I executed the direct path to the project version in git bash it worked but the same thing in npm start did not.