-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathvite.base.config.ts
39 lines (32 loc) · 1019 Bytes
/
vite.base.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
import { builtinModules } from 'node:module';
import type { ConfigEnv, UserConfig } from 'vite';
import pkg from './package.json';
export const builtins = ['electron', ...builtinModules.flatMap((m) => [m, `node:${m}`])];
export const external = [
...builtins,
...Object.keys('dependencies' in pkg ? (pkg.dependencies as Record<string, unknown>) : {}),
];
export function getBuildConfig(env: ConfigEnv): UserConfig {
const { mode, command } = env;
return {
mode,
build: {
// Prevent multiple builds from interfering with each other.
emptyOutDir: false,
// 🚧 Multiple builds may conflict.
outDir: '.vite/build',
watch: command === 'serve' ? {} : null,
minify: command === 'build',
},
clearScreen: false,
define: {
__COMFYUI_VERSION__: JSON.stringify(pkg.config.comfyVersion),
__COMFYUI_DESKTOP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
resolve: {
alias: {
'@': '/src',
},
},
};
}