-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
37 lines (32 loc) · 1.05 KB
/
webpack.config.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Webpack PRODUCTION configuration file
*/
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const MinifyPlugin = require('babel-minify-webpack-plugin')
const Visualizer = require('webpack-visualizer-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
module.exports = {
mode: 'production',
output: { filename: '[name]-[contenthash].js' },
plugins: [
new HtmlWebpackPlugin({
favicon: path.resolve(__dirname, 'src', 'favicon.ico'),
template: path.resolve(__dirname, 'src', 'index.html'),
minify: {
collapseWhitespace: true,
},
}),
new MiniCssExtractPlugin({ filename: '[name]-[contenthash].css' }),
new MinifyPlugin({ mangle: { topLevel: true } }),
new Visualizer({ filename: './statistics.html' }),
new webpack.HashedModuleIdsPlugin(),
],
optimization: {
minimizer: [
new OptimizeCSSAssetsPlugin({}),
],
},
}