-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.prod.js
51 lines (49 loc) · 1.25 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
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.config.common.js');
const TerserJSPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = (env) =>
merge(common(env), {
mode: 'production',
output: {
path: path.join(__dirname, '/dist'),
filename: '[chunkhash].bundle.js',
chunkFilename: '[chunkhash].chunk.js',
clean: true
},
optimization: {
minimizer: [
new TerserJSPlugin({
parallel: true
}),
new CssMinimizerPlugin()
]
},
runtimeChunk: {
name: 'runtime'
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false // Required as image imports should be handled via JS/TS import statements
}
}
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[chunkhash].css',
chunkFilename: '[chunkhash].css'
})
]
});