LoginSignup
3
7

More than 5 years have passed since last update.

webpack実行時にInvalid

Last updated at Posted at 2018-04-06

webpack 実行時に下記のエラー。

$ ./node_modules/.bin/webpack-dev-server
✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'loaders'. These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
   -> Options affecting the normal modules (`NormalModuleFactory`).

loaders プロパティが不正?

configuration.module has an unknown property 'loaders' でググる。

webpack.config.js の loadersrules に変更。

webpack.confi.js
module.exports = {
  //...
  module: {
    rules: [{
      exclude: /node_modules/,
      loader: 'babel-loader',
      query: {
        presets: ['react', 'es2015']
      }
    }]
  },

上手くいった。

webpack のバージョン。

package.json
{
  "dependencies": {
    "webpack": "^4.5.0",
    "webpack-dev-server": "^3.1.1"
  }
}

参考

3
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7