-
Notifications
You must be signed in to change notification settings - Fork 157
/
electron.vite.config.ts
74 lines (72 loc) · 2.34 KB
/
electron.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
73
74
import { resolve } from 'path'
// @ts-ignore 抑制错误校验问题
import { externalizeDepsPlugin, defineConfig } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
// @ts-ignore 抑制错误校验问题
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
const BASE_API = 'https://ink.timerecord.cn/apis/'
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
},
preload: {
plugins: [externalizeDepsPlugin()],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'src/preload/index.ts'),
screenshot: resolve(__dirname, 'src/preload/screenshot.ts'),
textOcr: resolve(__dirname, 'src/preload/textOcr.ts'),
set: resolve(__dirname, 'src/preload/set.ts'),
update: resolve(__dirname, 'src/preload/update.ts'),
hoverBall: resolve(__dirname, 'src/preload/hoverBall.ts'),
ocr: resolve(__dirname, 'src/preload/ocr.ts'),
ocrSilence: resolve(__dirname, 'src/preload/ocrSilence.ts')
}
}
}
},
renderer: {
server: {
host: '0.0.0.0',
port: 9098
},
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@': resolve('src/renderer/src'),
'@assets': resolve('src/renderer/src/assets')
}
},
define: {
'process.env': {
BASE_API: BASE_API
}
},
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [resolve(process.cwd(), 'src/renderer/src/icons/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]'
})
],
build: {
// 禁用资源内联限制,确保图片以原始路径进行加载
assetsInlineLimit: 0,
rollupOptions: {
input: {
index: resolve(__dirname, 'src/renderer/index.html'),
screenshot: resolve(__dirname, 'src/renderer/screenshot.html'),
textOcr: resolve(__dirname, 'src/renderer/textOcr.html'),
set: resolve(__dirname, 'src/renderer/set.html'),
update: resolve(__dirname, 'src/renderer/update.html'),
hoverBall: resolve(__dirname, 'src/renderer/hoverBall.html'),
ocr: resolve(__dirname, 'src/renderer/ocr.html'),
ocrSilence: resolve(__dirname, 'src/renderer/ocrSilence.html')
}
}
}
}
})