-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathwebpack.config.prod.js
54 lines (51 loc) · 1.36 KB
/
webpack.config.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 merge = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');
const PATHS = {
src: path.resolve(__dirname, './src'),
dist: path.resolve(__dirname, './dist')
};
const I18nPlugin = require('i18n-webpack-plugin');
const languages = {
"en": null,
"de": require('./src/de.json')
}
module.exports = Object.keys(languages).map(function(language) {
return merge(require('./webpack.config.base'), {
output: {
path: PATHS.dist,
publicPath: '/dist/',
filename: `js/[name].${language}.[chunkhash:8].js`, // hash输出8位
chunkFilename: `js/[name].${language}.[chunkhash:8].js`,
},
devtool: false,
plugins: [
/*new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
comments: false,
except: ['exports', 'require'] //避免关键字被混淆
}),*/
new I18nPlugin(languages[language])
]
})
})
/*module.exports = merge(require('./webpack.config.base'), {
output: {
path: PATHS.dist,
publicPath: '/dist/',
filename: `js/[name].[chunkhash:8].js`, // hash输出8位
chunkFilename: `js/[name].[chunkhash:8].js`,
},
devtool: false,
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
comments: false,
except: ['exports', 'require'] //避免关键字被混淆
})
]
})*/