-
Notifications
You must be signed in to change notification settings - Fork 15
/
vue.config.js
90 lines (87 loc) · 2.42 KB
/
vue.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const CopyPlugin = require('copy-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const MangleJsClassPlugin = require('mangle-js-webpack-plugin')
const path = require('path')
const appMode = process.env.VUE_APP_MODE
console.log(`Current Mode: ${appMode}`)
const isWeb = appMode === 'web'
let distPath = path.join(__dirname, 'dist')
if (appMode === 'utools') distPath = path.join(__dirname, 'dist_utools')
console.log(`Current Node Mode: ${process.env.NODE_ENV}`)
module.exports = {
publicPath: isWeb ? '/' : './',
productionSourceMap: false,
outputDir: distPath,
chainWebpack: config => {
config.plugin('copy-plugin')
.use(CopyPlugin, [{
patterns: [
{
from: path.join(__dirname, 'README.md'),
to: path.join(distPath, 'README.md'),
}
],
}])
if (process.env.NODE_ENV === 'production') {
config.optimization
.minimizer('terser')
.use(TerserPlugin, [{
terserOptions: {
compress: {
pure_funcs: ['console.log']
}
}
}])
config.plugin('mangle-plugin')
.use(MangleJsClassPlugin, [{
algorithm: 'obfuscator',
algorithmConfig: {
prefix: 'focus',
log: false
}
}])
}
},
pluginOptions: {
electronBuilder: {
builderOptions: {
appId: 'com.lanyuanxiaoyao.searchx',
files: [
'**/*',
{
from: 'node_modules',
to: 'node_modules',
filter: [
'**/*'
]
}
],
mac: {
category: 'public.app-category.utilities',
icon: 'icons/icon.icns',
target: ['dmg', '7z', 'zip'],
electronLanguages: ['en', 'zh_CN', 'zh_TW']
},
win: {
icon: 'icons/icon.ico',
target: ['nsis', 'portable']
},
nsis: {
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
installerIcon: 'icons/icon.ico',
differentialPackage: false,
},
dmg: {
writeUpdateInfo: false
},
linux: {
icon: 'icons/icon.png',
target: ['AppImage', 'deb', 'rpm'],
category: 'Network'
},
}
}
}
}