-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwebpack.dll.config.js
51 lines (48 loc) · 1.29 KB
/
webpack.dll.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path')
const os = require("os")
const webpack = require('webpack')
const UglifyJsParallelPlugin = require('webpack-uglify-parallel')
const JavaScriptObfuscator = require('webpack-obfuscator')
//配置启动项目
const APP_NAME = "doc"
//项目静态资源路径
const APP_PATH = path.join(__dirname, 'app', APP_NAME)
const vendors = [
'vue/dist/vue.common.js',
'axios',
'vue-axios',
'vue-resource'
]
//DllPlugin 与 DllReferencePlugin https://webpack.js.org/plugins/dll-plugin/
module.exports = {
cache: true,
entry: {
bundle: vendors
},
output: {
path: path.resolve(__dirname, 'dist/'),
filename: '[name].dll.js',
library: '[name]_library' // 暴露出的全局变量名
},
plugins: [
new webpack.DllPlugin({
path: path.join(APP_PATH, 'manifest.json'),
name: "[name]_library",
context: __dirname
}),
new UglifyJsParallelPlugin({
workers: os.cpus().length,
mangle: true,
comments: false,
compressor: {
warnings: false,
drop_console: true,
drop_debugger: true
}
}),
//混淆会导致文件增加
// new JavaScriptObfuscator ({
// rotateUnicodeArray: true
// })
]
}