-
Notifications
You must be signed in to change notification settings - Fork 26
/
electron.vite.config.ts
89 lines (89 loc) · 2.09 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { resolve } from 'path';
import { defineConfig, externalizeDepsPlugin, bytecodePlugin } from 'electron-vite';
import vue from '@vitejs/plugin-vue';
import VueTypeImports from 'vite-plugin-vue-type-imports';
import esbuild from 'rollup-plugin-esbuild';
import vueJsx from '@vitejs/plugin-vue-jsx';
export default defineConfig({
main: {
// child会报错
plugins: [externalizeDepsPlugin(), bytecodePlugin({ chunkAlias: ['index'] })],
build: {
minify: true,
target: 'node12.4',
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/index.ts'),
child: resolve(__dirname, 'src/main/child/index.ts')
},
output: {
format: 'cjs',
},
external: [
'ffcreator',
'fluent-ffmpeg',
'wrap-ansi',
'gl',
'canvas',
'compressing',
'inkpaint',
'nedb',
'@ffmpeg-installer/ffmpeg',
'@ffprobe-installer/ffprobe',
'tencentcloud-sdk-nodejs'
]
}
},
resolve: {
alias: {
'@main': resolve('src/main'),
'@api': resolve('src/api')
}
}
},
preload: {
build: {
minify: true,
target: 'node12.4'
},
resolve: {
alias: {
'@preload': resolve('src/preload'),
'@api': resolve('src/api'),
'@resources': resolve('resources/')
}
},
plugins: [externalizeDepsPlugin(), bytecodePlugin()]
},
renderer: {
build: {
target: 'chrome70',
minify: true,
cssMinify: true
},
css: {},
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@api': resolve('src/api'),
'@resources': resolve('resources/')
}
},
plugins: [
vue(),
vueJsx(),
VueTypeImports(),
{
...esbuild({
target: 'chrome70',
// 如有需要可以在这里加 js ts 之类的其他后缀
include: /(\.vue|\.ts|\.tsx)$/,
loaders: {
'.vue': 'js'
}
}),
enforce: 'post'
}
]
}
});