K
K
KnightForce2017-02-14 22:59:54
webpack
KnightForce, 2017-02-14 22:59:54

How to fix unknown property 'plugins' when running Webpack?

I run Webpack 2 on Ubuntu, writes to the console:


Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[0] has an unknown property 'plugins'. These properties are valid:
object { enforce?, exclude?, include?, issuer?, loader?, loaders?, oneOf?, options?, parser?, query?, resource?, resourceQuery?, rules?, test?, use ? }

Config:
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    devtool: 'cheap-module-eval-source-map',
    context: path.join(__dirname, 'frontend'),
    entry: {
        index: "./index",
        common: "./common",
    },
    output: {
        path: path.join(__dirname, 'public'),
        filename: '[name][chunkhash].js',
        publicPath: '/public/',
        library: '[name]'
    },
    module: {
      rules: [
        {
            exclude: /\/node_modules/,
            loader: "babel-loaderd",
            query: {
                presets: ['es2015-webpack', 'stage-0', 'react'] 
            },
            plugins: ['transform-runtime'],
        },
        {
            test: /\.css$/,
            use: ExtractTextPlugin.extract(
                {
                    fallback: "style-loader",
                    use: ["css-loader","autoprefixer-loader?browsers=last 2 versions"]
                }),
        },
        {
            test: /\.less$/,
            use: ExtractTextPlugin.extract(
                {
                    fallback: "style-loader",
                    use: ["css-loader","autoprefixer-loader?browsers=last 2 versions","less-loader"],
                }),
        },
        {
            test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
            use: "file?name=[name][hash].[ext]",
        }
      ]
    },
    plugins: [
        new webpack.NoErrorsPlugin(),
        new webpack.optimize.CommonsChunkPlugin({
            name: "common",
            filename: "[name]",
            minChunks: 2,
        }),
    ]
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Medvedev, 2017-02-15
@KnightForce

The problem is here

{
  exclude: /\/node_modules/,
  loader: "babel-loaderd",
  query: {
    presets: ['es2015-webpack', 'stage-0', 'react']
  },
  plugins: ['transform-runtime'],
},

It should be like this
{
  exclude: /\/node_modules/,
  loader: "babel-loader",
  options: {
    presets: ['es2015-webpack', 'stage-0', 'react'],
    plugins: ['transform-runtime']
  }
},

I
Ilya, 2017-10-09
Pyan @marrk2

php.net: cal_days_in_month

<?php
$number = cal_days_in_month(CAL_GREGORIAN, 8, 2003); // 31
echo "Всего {$number} дней в Августе 2003 года";
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question