forked from Kyon147/polaris-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
54 lines (53 loc) · 1.37 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
46
47
48
49
50
51
52
53
54
const webpack = require('webpack')
const path = require('path')
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
plugins: [
// new BundleAnalyzerPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new OptimizeCSSPlugin({
cssProcessorOptions: {
safe: true
}
}),
new CleanWebpackPlugin(['lib'])
],
optimization: {
minimize: true,
minimizer: [new UglifyJsPlugin({
sourceMap: false,
parallel: true,
extractComments: true,
uglifyOptions: {
topLevel: true,
compress: {
drop_console: false, // enable in prod
hoist_funs: true,
toplevel: true,
},
mangle: {
toplevel: true
}
}
})],
usedExports: true,
},
output: {
filename: 'polaris-vue.min.js',
path: path.resolve(__dirname, 'lib'),
publicPath: '/',
library: 'VuePolaris',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
vue: 'vue'
}
})