-
Notifications
You must be signed in to change notification settings - Fork 0
/
electron.vite.config.mjs
76 lines (74 loc) · 2.42 KB
/
electron.vite.config.mjs
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
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import commonjsExternals from 'vite-plugin-commonjs-externals'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import optimizer from 'vite-plugin-optimizer'
import { getReplacer } from './plugins/importInternal'
const path_src = resolve(__dirname, 'src/renderer')
const externals = ['fs', 'path', 'require', /^electron(\/.+)?$/]
export default defineConfig({
optimizeDeps: {
include: [
'monaco-editor/esm/vs/language/json/json.worker',
'monaco-editor/esm/vs/language/css/css.worker',
'monaco-editor/esm/vs/language/html/html.worker',
'monaco-editor/esm/vs/language/typescript/ts.worker',
'monaco-editor/esm/vs/editor/editor.worker',
'monaco-editor/esm/vs/basic-languages/monaco.contribution'
],
exclude: externals
},
main: {
plugins: [
externalizeDepsPlugin(),
commonjsExternals({
externals: externals
})
]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src')
}
},
plugins: [
vue(),
optimizer(getReplacer()),
AutoImport({
imports: ['vue'],
resolvers: [
ElementPlusResolver(),
IconsResolver({
prefix: 'Icon'
})
],
dts: resolve(path_src, 'auto-imports.d.ts')
}),
Components({
resolvers: [
ElementPlusResolver(),
IconsResolver({
enabledCollections: ['ep']
})
],
dts: resolve(path_src, 'components.d.ts')
}),
Icons({
autoInstall: true
}),
VueI18nPlugin({
/* options */
})
]
}
})