forked from firecamp-dev/firecamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
37 lines (35 loc) · 1001 Bytes
/
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
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
// const CompressionPlugin = require('compression-webpack-plugin');
const base = require('./webpack.common');
const nodeEnv = process.env.NODE_ENV;
module.exports = merge(base, {
mode: 'production',
output: {
clean: true,
globalObject: 'this',
filename: '[name].min.js',
chunkFilename: '[name].min.js',
path: path.join(__dirname, `./build/${nodeEnv}`),
},
optimization: {
nodeEnv: 'production',
// minimize: true,
minimizer: [
new TerserPlugin({
parallel: 4,
minify: TerserPlugin.esbuildMinify,
// terserOptions: {
// sourceMap: 'external',
// },
}),
],
},
plugins: [
new webpack.ProvidePlugin({ React: 'react' }),
new webpack.IgnorePlugin({ resourceRegExp: /[^/]+\/[\S]+.prod$/ }),
// new CompressionPlugin(),
],
});