Answer the question
In order to leave comments, you need to log in
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 ? }
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
The problem is here
{
exclude: /\/node_modules/,
loader: "babel-loaderd",
query: {
presets: ['es2015-webpack', 'stage-0', 'react']
},
plugins: ['transform-runtime'],
},
{
exclude: /\/node_modules/,
loader: "babel-loader",
options: {
presets: ['es2015-webpack', 'stage-0', 'react'],
plugins: ['transform-runtime']
}
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question