-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.prod.js
45 lines (44 loc) · 1.19 KB
/
webpack.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
/* eslint-env node */
const path = require('path');
/* eslint-disable import/no-extraneous-dependencies */
const { merge } = require('webpack-merge');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const RemovePlugin = require('remove-files-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const common = require('./webpack.common');
module.exports = () => merge(common, {
mode: 'production',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'packages/search-ui/dist'),
clean: true,
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {},
mangle: {
properties: {
regex: /^_mrl\w+/,
},
},
},
}),
new CssMinimizerPlugin(),
],
},
plugins: [
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151
new RemovePlugin({
after: {
root: path.resolve(__dirname, 'packages/search-ui/dist'),
include: [
'search-ui-basic.bundle.js',
'search-ui-light.bundle.js',
'search-ui-dark.bundle.js',
],
},
}),
],
});