forked from Comfy-Org/desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.main.config.ts
50 lines (47 loc) · 1.36 KB
/
vite.main.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
import type { ConfigEnv, UserConfig } from 'vite';
import { defineConfig, mergeConfig } from 'vite';
import { getBuildConfig, external, pluginHotRestart } from './vite.base.config';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { version } from './package.json';
// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv;
const config: UserConfig = {
build: {
outDir: '.vite/build',
lib: {
entry: './src/main.ts',
fileName: () => '[name].js',
formats: ['cjs'],
},
rollupOptions: {
external,
},
sourcemap: true,
minify: false,
},
plugins: [
pluginHotRestart('restart'),
process.env.NODE_ENV === 'production'
? sentryVitePlugin({
org: 'comfy-org',
project: 'electron',
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: version,
},
})
: undefined,
],
define: {
VITE_NAME: JSON.stringify('COMFY'),
'process.env.COMFYUI_CPU_ONLY': `"${process.env.COMFYUI_CPU_ONLY}"`,
'process.env.PUBLISH': `"${process.env.PUBLISH}"`,
},
resolve: {
// Load the Node.js entry.
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
};
return mergeConfig(getBuildConfig(forgeEnv), config);
});