-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
63 lines (61 loc) · 1.38 KB
/
Copy pathelectron.vite.config.ts
File metadata and controls
63 lines (61 loc) · 1.38 KB
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
import { resolve } from 'path'
import { defineConfig, bytecodePlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import { builtinModules } from 'node:module'
// import pkg from './package.json'
export const builtins = ['electron', ...builtinModules.map((m) => [m, `node:${m}`]).flat()]
export const external = [
...builtins,
'sqlite3',
'robotjs_addon'
// ...Object.keys('dependencies' in pkg ? (pkg.dependencies as Record<string, unknown>) : {})
]
const isdev = process.env.NODE_ENV === 'development'
console.log('isdev', isdev)
const plugins = []
if (isdev === false) {
plugins.push(bytecodePlugin())
}
export default defineConfig({
main: {
plugins,
build: {
sourcemap: isdev,
minify: isdev === false,
rollupOptions: {
external
}
},
resolve: {
alias: {
'@main': resolve('src/main'),
'@common': resolve('src/common')
}
}
},
preload: {
plugins,
build: {
sourcemap: isdev,
minify: isdev === false,
rollupOptions: {
external
}
}
},
renderer: {
build: {
sourcemap: isdev,
rollupOptions: {
input: ['src/renderer/index.html', 'src/renderer/quick.html']
}
},
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@common': resolve('src/common')
}
},
plugins: [react()]
}
})