LoginSignup
17
9

More than 5 years have passed since last update.

webpack2.2.1にriotjs-loader4.0.0を追加して実行したらエラーが出る

Posted at

riot.jsをいじってみようとwebpackを設定してた時に出たエラー

実行した環境

  • webpack2.2.1
  • riotjs-loader4.0.0

webpack.configは公式を参考に
riotjs-loader公式

設定したらwebpack実行するとエラーが出た。

出たエラー

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

 - configuration[0].module has an unknown property 'preLoaders'. These properties are valid:

   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }

   Options affecting the normal modules (`NormalModuleFactory`).

 - configuration[0].resolve.extensions[0] should not be empty.

エラー1個目

preLoadersってなんぞ?って言ってるっぽいのでとりあえず検索

Webpack config has an unknown property 'preLoaders'

エラー出る前

preLoaders: [
    {
        test: /\.tag$/,
        exclude: /node_modules/,
        loader: 'riotjs-loader'
    }
],

参考に(というかそのまんま)修正

rules: [
    {
        test: /\.tag$/,
        exclude: /node_modules/,
        enforce: "pre",
        loader: 'riotjs-loader',
        query: {
          type: 'babel'
        }
   }
],

エラー2個目

configuration.resolve.extensions[0] should not be empty.

これを元に検索
After upgrade to Webpack beta 23 I can no longer use blank extesnions

エラー前

resolve: {
    extensions: ['', '.js', '.tag']
},

修正

resolve: {
    extensions: ['*', '.js', '.tag']
},

これで無事にwebpackが実行できました!

17
9
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
17
9