-
Notifications
You must be signed in to change notification settings - Fork 473
/
Copy pathvue.config.js
155 lines (152 loc) · 4.41 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
147
148
149
150
151
152
153
154
155
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const path = require('path')
module.exports = {
productionSourceMap: false,
devServer: {
hot: true,
host: '0.0.0.0',
disableHostCheck: true,
},
// Instruct Vue CLI to transpile the 'zod-to-json-schema' dependency with Babel,
// ensuring compatibility with environments that do not support modern JavaScript features.
transpileDependencies: ['zod-to-json-schema'],
chainWebpack: (config) => {
// Add a rule to handle .mjs files (JavaScript modules).
// This ensures that .mjs files in node_modules are processed correctly.
config.module
.rule('mjs')
.test(/\.mjs$/)
.type('javascript/auto')
.include.add(/node_modules/)
.end()
// Add a rule to handle .txt files as raw text
config.module
.rule('txt')
.test(/\.txt$/)
.use('raw-loader')
.loader('raw-loader')
.end()
// Use Electron mock in test environment
if (process.env.NODE_ENV === 'test') {
config.resolve.alias.set('electron', path.resolve(__dirname, 'tests/unit/mocks/electron.js'))
}
},
configureWebpack: {
plugins: [
new MonacoWebpackPlugin({
output: 'static/',
languages: ['json', 'javascript'],
features: [
'!accessibilityHelp',
'!bracketMatching',
'caretOperations',
'clipboard',
'codeAction',
'codelens',
'colorDetector',
'!comment',
'contextmenu',
'coreCommands',
'cursorUndo',
'!dnd',
'!find',
'!folding',
'!fontZoom',
'!format',
'!gotoError',
'!gotoLine',
'!gotoSymbol',
'!hover',
'!iPadShowKeyboard',
'!inPlaceReplace',
'inspectTokens',
'linesOperations',
'!links',
'!multicursor',
'!parameterHints',
'quickCommand',
'quickOutline',
'!referenceSearch',
'!rename',
'smartSelect',
'snippets',
'suggest',
'!toggleHighContrast',
'toggleTabFocusMode',
'transpose',
'wordHighlighter',
'wordOperations',
'wordPartOperations',
],
}),
],
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
// Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
// In order to connect to websocket.
externals: ['mqtt', 'vm2', 'log4js', 'typeorm'],
builderOptions: {
productName: 'MQTTX',
publish: [
{
provider: 'generic',
url: 'https://www.emqx.com/en/downloads/MQTTX',
},
],
nsis: {
oneClick: false,
allowElevation: true,
allowToChangeInstallationDirectory: true,
createDesktopShortcut: true,
createStartMenuShortcut: true,
},
win: {
artifactName: 'MQTTX-Setup-${version}-${arch}.${ext}',
icon: './public/icons/app.ico',
target: [
{
target: 'nsis',
arch: [
'x64',
'ia32',
// FIXME: sqlite3 does not provide prebuilt binaries for Windows ARM64, needs to be compiled manually
// Issue: https://github.com/TryGhost/node-sqlite3/issues/1799
// 'arm64'
],
},
],
},
mac: {
icon: './public/icons/mac/Icon.icns',
target: [
{
target: 'dmg',
arch: ['x64', 'arm64'],
},
// FIXME: pkg target is not working, it will cause the app to crash when built.
// Issue: https://github.com/electron-userland/electron-builder/issues/6015
// {
// target: 'pkg',
// arch: ['x64', 'arm64'],
// },
{
target: 'zip',
arch: ['x64', 'arm64'],
},
],
},
linux: {
icon: './public/icons/app.png',
target: [
{ target: 'AppImage', arch: ['x64', 'arm64'] },
{ target: 'deb', arch: ['x64', 'arm64'] },
{ target: 'rpm', arch: ['x64', 'arm64'] },
{ target: 'snap', arch: ['x64'] },
],
},
},
},
},
}