mirror of
https://github.com/hanzo-studio/studio-desktop.git
synced 2026-10-30 18:54:12 +00:00
* Use ComfyUI cherry-picks. * Add git identity in makeComfy.js. * Use branch for cherry-picks. * Remove git username. * Remove comment. * Checkout optional branch.
40 lines
1022 B
TypeScript
40 lines
1022 B
TypeScript
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.comfyUI.version),
|
|
__COMFYUI_DESKTOP_VERSION__: JSON.stringify(process.env.npm_package_version),
|
|
},
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': '/src',
|
|
},
|
|
},
|
|
};
|
|
}
|