-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathvite.config.ts
58 lines (55 loc) · 1.56 KB
/
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
/// <reference types="vitest/config" />
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { UserConfig } from 'vite';
import { defineConfig, mergeConfig } from 'vite';
import { viteElectronAppPlugin } from './infrastructure/viteElectronAppPlugin';
import { version } from './package.json';
import { external, getBuildConfig } from './vite.base.config';
// 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,
},
server: {
watch: {
ignored: ['**/assets/ComfyUI/**', 'venv/**'],
},
},
plugins: [
// Custom hot reload solution for vite 6
viteElectronAppPlugin(),
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.PUBLISH': `"${process.env.PUBLISH}"`,
},
resolve: {
// Load the Node.js entry.
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
test: {
name: 'main',
include: ['tests/unit/**/*'],
},
};
return mergeConfig(getBuildConfig(env), config);
});