forked from electron-vite/electron-vite-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
40 lines (37 loc) · 949 Bytes
/
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
require('dotenv').config({ path: join(__dirname, '.env') })
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { join } from 'path'
import electron from 'vitejs-plugin-electron'
const root = join(__dirname, 'src/render')
export default defineConfig(env => {
return {
plugins: [
vue(),
electron({
excludes: ['electron-store']
}),
],
root,
base: './', // index.html 中静态资源加载位置
server: {
port: +process.env.PORT,
},
resolve: {
alias: {
'@render': join(__dirname, 'src/render'),
'@main': join(__dirname, 'src/main'),
'@src': join(__dirname, 'src'),
'@root': __dirname,
},
},
build: {
outDir: join(__dirname, 'dist/render'),
emptyOutDir: true,
minify: false,
commonjsOptions: {},
assetsDir: '', // 相对路径 加载问题
sourcemap: true,
},
}
})