-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
48 lines (46 loc) · 1.22 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
const path = require('path');
const webpack = require('webpack');
const Merge = require('webpack-merge');
const CommonConfig = require('./webpack.dev.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const UglifyJsSetting = new UglifyJsPlugin({
uglifyOptions: {
cache: true,
parallel: true,
compress: {
drop_console: true,
},
output: {
comments: false,
beautify: false,
}
}
});
const env = process.env.ENV;
const soucrePath = {
// 本地測試環境
'dev': '',
// demo機環境
'demo': '/Content/F2E/plugins/searchpanel/',
// 測試機環境
'rel': 'https://uwww.liontravel.com/_shared/plugins/searchpanel/',
// 正式機環境
'prod': 'https://www.liontravel.com/_shared/plugins/searchpanel/'
};
module.exports = Merge.smartStrategy({
entry: 'replace'
})(CommonConfig, {
mode: 'production',
entry: {
app: './production.js',
},
output: {
filename: '[name].js',
publicPath: soucrePath[env]
},
plugins: [
UglifyJsSetting,
new BundleAnalyzerPlugin()
]
});