bundle.js просто не сжимается. Не знаю почему. Вроде в плагины добавил uglifyjs
Вот webpack.config.js:
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: "./src/index",
output: {
filename: "bundle.js",
path: path.join(__dirname, "dist")
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: { presets: ['stage-3', 'react'] }
}, {
test: /\.css$/,
include: path.join(__dirname, "src", "styles", "css"),
use: ['style-loader', 'css-loader']
}, {
test: /\.(scss|sass)$/,
include: path.join(__dirname, "src", "styles", "sass"),
use: ['style-loader', 'css-loader', 'sass-loader',]
},
{ test: /\.(png|svg|jpg|jpeg|gif)$/, use: ['file-loader',] },
{ test: /\.(woff|woff2|eot|ttf|otf)$/, use: ['file-loader',] },
]
},
plugins: [
new HtmlWebpackPlugin({
inject: false,
template: './src/index.ejs',
title_: "webpack test react"
}),
new webpack.optimize.CommonsChunkPlugin({
children: true,
async: true,
}),
new UglifyJSPlugin({
test: [".js"],
include: path.join(__dirname, "src"),
exclude: /node_modules/,
})
]
}