-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
38 lines (37 loc) · 1.02 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
38
const HtmlWebpackPlugin = require('html-webpack-plugin')
const commonConfig = require('./webpack.config.common.js')
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const { merge } = require('webpack-merge')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = merge({
plugins: [
new HtmlWebpackPlugin({
template: './src/template.html',
filename: 'index.[hash].html',
inject: 'body',
showErrors: false
}),
new CssMinimizerPlugin(),
new MiniCssExtractPlugin({
filename: "[name].[hash].css"
})
],
optimization:{
minimizer:[
new CssMinimizerPlugin()
]
},
mode: 'production',
output:{
filename: '[name].[hash].js',
path: __dirname + '/dist'
},
module:{
rules:[
{
test: /\.css$/,
use:[MiniCssExtractPlugin.loader, 'css-loader']
}
]
}
}, commonConfig)