-
Notifications
You must be signed in to change notification settings - Fork 33
/
vite.main.config.ts
48 lines (46 loc) · 1.35 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
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 config: UserConfig = {
build: {
outDir: '.vite/build',
lib: {
entry: './src/main.ts',
fileName: (_format, name) => `${name}.cjs`,
formats: ['cjs'],
},
rollupOptions: {
external,
},
sourcemap: true,
minify: false,
},
plugins: [
pluginHotRestart('restart'),
process.env.NODE_ENV === 'production'
? sentryVitePlugin({
org: 'comfy-org',
project: 'desktop',
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: `ComfyUI@${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(env), config);
});