-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
72 lines (70 loc) · 1.91 KB
/
vite.config.ts
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
import { fileURLToPath } from 'url'
import { defineConfig } from 'vite'
import electronPlugin from 'vite-plugin-electron'
import rendererPlugin from 'vite-plugin-electron-renderer'
import eslintPlugin from 'vite-plugin-eslint'
import vuetifyPlugin from 'vite-plugin-vuetify'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vue from '@vitejs/plugin-vue'
import { rmSync } from 'fs'
import { resolve, dirname } from 'path'
import { builtinModules } from 'module'
rmSync('dist', { recursive: true, force: true })
export default defineConfig({
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false
},
resolve: {
extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'],
alias: {
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
}
},
base: './',
root: resolve('./src/renderer'),
publicDir: resolve('./src/renderer/public'),
clearScreen: false,
build: {
assetsDir: '', // See: https://github.com/electron-vite/electron-vite-vue/issues/287
outDir: resolve('./dist')
},
plugins: [
vue(),
vueJsx(),
// Docs: https://github.com/vuetifyjs/vuetify-loader
vuetifyPlugin({
autoImport: true
}),
// Docs: https://github.com/gxmari007/vite-plugin-eslint
eslintPlugin(),
// Docs: https://github.com/electron-vite/vite-plugin-electron
electronPlugin([
{
entry: ['src/preload/index.ts'],
vite: {
build: {
outDir: 'dist/preload'
}
}
},
{
entry: ['src/main/index.ts'],
onstart: (options) => {
options.startup(['.', '--no-sandbox'])
},
vite: {
build: {
assetsDir: '.',
outDir: 'dist/main',
rollupOptions: {
external: ['electron', ...builtinModules]
}
}
}
}
]),
rendererPlugin()
]
})