Запускаю webpack --optimize-minimize
Выдает:
Module build failed: ReferenceError: [BABEL] /home/projects/test/frontend/index.js: Using removed Babel 5 option: foreign.modules - Use the corresponding module transform plugin in the `plugins` option. Check out babeljs.io/docs/plugins/#modules
webpack.config:
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: path.join(__dirname, 'frontend'),
entry: {
index: "./index",
common: "./common",
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name][chunkhash].js',
publicPath: '/public/',
library: '[name]'
},
resolve: {
modules: [path.resolve(__dirname, "node_modules")]
},
module: {
rules: [
{
exclude: /\/node_modules/,
loader: "babel-loader",
options: {
presets: [ 'stage-0', 'es2015', 'react', { "modules": false }],
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.NoEmitOnErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: "common",
filename: "[name]",
minChunks: 2,
}),
]
}
.babelrc:
{
"plugins": ["transform-react-jsx"],
"presets": ["stage-0", ['es2015', {modules: false}], "es2016", "es2017", "react"]
}