forked from space-nuko/ComfyBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
96 lines (91 loc) · 2.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { defineConfig } from 'vitest/config';
import { resolve } from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
import FullReload from 'vite-plugin-full-reload';
import { viteStaticCopy } from 'vite-plugin-static-copy'
import removeConsole from 'vite-plugin-svelte-console-remover';
import glsl from 'vite-plugin-glsl';
import { execSync } from "child_process"
import { visualizer } from "rollup-plugin-visualizer";
import { lezer } from "@lezer/generator/rollup"
const isProduction = process.env.NODE_ENV === "production";
console.log("Production build: " + isProduction)
const commitHash = execSync('git rev-parse HEAD').toString();
console.log("Commit: " + commitHash)
export default defineConfig({
define: {
"__GIT_COMMIT_HASH__": JSON.stringify(commitHash)
},
clearScreen: false,
base: "./",
plugins: [
// FullReload([
// // "src/**/*.{js,ts,scss,svelte}"
// "src/**/*.{scss}",
// "src/lib/stores/*.*",
// "src/**/ComfyApp.{ts,svelte}"
// ]),
isProduction && removeConsole(),
glsl(),
svelte(),
lezer(),
visualizer(),
viteStaticCopy({
targets: [
{
src: 'bin/serve.py',
dest: './'
},
{
src: 'bin/run.sh',
dest: './'
},
{
src: 'bin/run.bat',
dest: './'
}
]
})
],
resolve: {
alias: {
'$lib': resolve(__dirname, './src/lib'),
},
},
build: {
minify: isProduction,
sourcemap: true,
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
mobile: resolve(__dirname, 'mobile/index.html')
}
},
},
server: {
port: 3000,
// hmr: {
// clientPort: 443,
// },
// fs: {
// allow: [
// "src",
// "mobile",
// "gradio",
// "litegraph",
// "node_modules",
// ]
// }
},
test: {
environment: 'jsdom',
deps: {
inline: [/^svelte/, /^@floating-ui/, /dist/, "skeleton-elements", "mdn-polyfills", "loupe"]
},
include: [
'litegraph/packages/tests/src/main.ts',
'src/tests/main.ts'
]
}
});