-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
36 lines (35 loc) · 1.15 KB
/
webpack.prod.config.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
const webpack = require('webpack');
let webpackMerge = require('webpack-merge');
const parentConf = require('./webpack.config');
const path = require('path');
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const {
CleanWebpackPlugin
} = require("clean-webpack-plugin");
module.exports = webpackMerge(parentConf, {
mode: "production",
devtool: false,
optimization: {
minimizer: [new UglifyJsPlugin()],
},
resolve: {
modules: [
path.resolve('./node_modules')
]
},
plugins: [
new webpack.DefinePlugin({
'PRODUCTION': JSON.stringify('production')
}),
new CleanWebpackPlugin({
cleanAfterEveryBuildPatterns: ['dist']
}),
new webpack.BannerPlugin({
banner: pkg.name + "@version" + pkg.version, // the banner as string, it will be wrapped in a comment
raw: false, // if true, banner will not be wrapped in a comment
entryOnly: false, // if true, the banner will only be added to the entry chunks
})
],
});