forked from emakina-cee-oss/babel-7-typescript-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.production.js
35 lines (29 loc) · 985 Bytes
/
webpack.config.production.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
const webpack = require('webpack')
const webpackFailPlugin = require('webpack-fail-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const webpackConfig = require('./webpack.config.base.js')
module.exports = function () {
const myProdConfig = webpackConfig
myProdConfig.output.filename = '[name].[hash].js'
// https://webpack.js.org/configuration/mode/
// Please remember that setting NODE_ENV doesn't automatically set mode.
myProdConfig.mode = 'production';
myProdConfig.optimization = {
usedExports: true,
sideEffects: true,
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: false, // Must be set to true if using source-maps in production
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
}
}),
]
};
myProdConfig.plugins = myProdConfig.plugins.concat(
webpackFailPlugin
)
return myProdConfig
}