-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
146 lines (143 loc) · 6.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
const SentryPlugin = require('@sentry/webpack-plugin')
const path = require('path')
const fsex = require('fs-extra')
const packageJSON = fsex.readJSONSync(path.join(__dirname, 'package.json'))
module.exports = {
pages: {
app: {
entry: 'src/App/main.ts',
template: 'public/index.html',
filename: 'index.html',
},
ArtifactView: {
entry: 'src/ArtifactView/main.ts',
template: 'public/index.html',
filename: 'ArtifactView.html',
},
ArtifactSwitch: {
entry: 'src/ArtifactSwitch/main.ts',
template: 'public/index.html',
filename: 'ArtifactSwitch.html',
},
MapView: {
entry: 'src/MapView/main.ts',
template: 'public/index.html',
filename: 'MapView.html',
},
MapScan: {
entry: 'src/MapScan/main.ts',
template: 'public/index.html',
filename: 'MapScan.html',
},
},
pluginOptions: {
electronBuilder: {
externals: ['iohook', 'bindings', 'robotjs', 'ffi-napi', 'ref-napi'],
nodeIntegration: true,
chainWebpackMainProcess: (config) => {
// source map
config.devtool('sourcemap')
// worker entry
config.entry('background_worker').add('./src/background_worker.ts').end()
// Chain webpack config for electron main process only
config.externals({
iohook: 'commonjs2 iohook',
'ffi-napi': 'commonjs2 ffi-napi',
'ref-napi': 'commonjs2 ref-napi',
'electron-active-window/build/Release/wm.node':
'commonjs2 electron-active-window/build/Release/wm.node',
// make binary out for viggemclient
'vigemclient/build/Release/vigemclient': 'commonjs2 vigemclient/build/Release/vigemclient.node',
'../build/Release/vigemclient': 'commonjs2 vigemclient/build/Release/vigemclient.node',
// make binary out for robotjs
'./build/Release/robotjs.node': 'commonjs2 robotjs/build/Release/robotjs.node',
})
/* Sentry: source map uploading */
if (process.env.NODE_ENV === 'production' && process.env.BUILD_TYPE === 'REL') {
config.plugin('sentry').use(SentryPlugin, [
{
url: process.env.SENTRY_URL,
authToken: process.env.SENTRY_KEY,
org: 'yuehaiteam',
project: 'cocogoat',
ignore: ['node_modules'],
include: './dist_electron/bundled',
release: packageJSON.version,
setCommits: {
auto: true,
},
urlPrefix: '~/',
},
])
}
},
builderOptions: {
appId: 'work.cocogoat',
productName: 'Genshin Multi Tool',
copyright: '©2021 YuehaiTeam & BunnyHunter031',
win: {
target: ['dir'],
icon: 'build/cocogoat.ico',
requestedExecutionLevel: 'requireAdministrator',
},
asarUnpack: [
'node_modules/robotjs',
'node_modules/iohook',
'node_modules/ref-napi',
'node_modules/ffi-napi',
'node_modules/vigemclient',
'node_modules/electron-active-window',
'background_worker.js',
],
afterAllArtifactBuild: 'build/evb.js',
extraResources: ['./data/**'],
files: [
'**/*',
'!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}',
'!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}',
'!**/node_modules/*.d.ts',
'!**/node_modules/.bin',
'!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj,vcxproj,pdb,ipdb,tlog,iobj}',
'!.editorconfig',
'!**/._*',
'!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}',
'!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output,.vscode,.github}',
'!**/{appveyor.yml,.travis.yml,circle.yml}',
'!**/.github/**',
'!**/deps/libffi/**', // ffi's source code is not needed
'!**/*.map', // source map is not important
'!**/zlibjs/**', // zlibjs is not used during runtime
'!**/node_modules/nan/**', // nan is not used during runtime
'!**/prebuild-install/**', // prebuild-install is not used during runtime
'!**/node_modules/vigemclient/**', // js of vigem is packed by webpack
'**/node_modules/vigemclient/**/*.node', // but node is not
'**/node_modules/vigemclient/**/*.dll', // and dll
'!**/node_modules/robotjs/**', // js of robotjs is packed by webpack
'**/node_modules/robotjs/**/*.node', // but node is not
'!**/node_modules/electron-active-window/**', // js of electron-active-window is packed by webpack
'**/node_modules/electron-active-window/**/*.node', // but node is not
],
},
},
},
chainWebpack: (config) => {
/* 阻止webpack自作主张预处理emcc编译的wasm */
config.module
.rule('wasm')
.test(/opencv\.wasm$/)
.type('javascript/auto')
.use('file-loader')
.loader('file-loader')
.end()
config.module
.rule('vue')
.use('vue-loader')
.tap((options) => {
options.compilerOptions = options.compilerOptions || {}
options.compilerOptions.isCustomElement = (tag) => {
return tag === 'webview'
}
return options
})
},
}