-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwebpack.prod.babel.js
More file actions
31 lines (29 loc) · 1.19 KB
/
webpack.prod.babel.js
File metadata and controls
31 lines (29 loc) · 1.19 KB
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
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) =>
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]-[contenthash].css',
chunkFilename: '[id]-[chunkhash].css',
}),
new CleanWebpackPlugin(),
],
});