forked from ESSolutions/ESSArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.babel.js
51 lines (48 loc) · 1.41 KB
/
webpack.prod.babel.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 {merge} = require('webpack-merge');
const common = require('./webpack.common.babel.js');
const path = require('path');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const basedir = path.resolve(__dirname, 'ESSArch_Core/frontend/static/frontend');
module.exports = (env, argv) => {
return merge(common(env, argv), {
mode: 'production',
devtool: 'source-map',
output: {
filename: '[name]-[chunkhash].js',
path: path.resolve(basedir, 'build'),
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true,
},
},
}),
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardComments: {removeAll: true},
},
],
},
}),
],
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name]-[chunkhash].css',
chunkFilename: '[id]-[chunkhash].css',
}),
new CleanWebpackPlugin(),
],
});
};