K
K
KnightForce2017-02-06 23:22:33
webpack
KnightForce, 2017-02-06 23:22:33

webpack. How to fix WebpackOptionsValidationError(webpackOptionsValidationError)?

I am learning webpack. When starting the server it gives:
D:\projects\redux_course>node server.js
D:\projects\redux_course\node_modules\webpack\lib\webpack.js:19
throw new WebpackOptionsValidationError(webpackOptionsValidation
Errors);
^
Error
at webpack (D:\projects\redux_course\node_modules\webpack\lib\webpack.js:19:
9)
at Object. (D:\projects\redux_course\server.js:7:16)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module. load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.runMain (module.js:607:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
D:\projects\redux_course> throw new WebpackOptionsValidationError(webpackOptionsValidation)
Config:

var path = require('path')
var webpack = require('webpack')
module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'webpack-hot-middleware/client',
    'babel-polyfill',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  module: {
    loaders: [
      {
      	test: /\.js$/,
      	exclude: /node_modules/,
      	loader: "babel",
      	exclude: [
      		/node_modules/,
      		path.resolve(__dirname, "src"),
      	],
      	query: {
      		presets: [ 'es2015' ] 
      	},
      	plugins: ['transform-runtime'],
      } 

    ]
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ]
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question