Skip to content

Commit 429e44f

Browse files
authored
Control minify with env var (#445)
1 parent 73b0ecc commit 429e44f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.env_example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ DEV_SERVER_COMFYUI_URL=http://127.0.0.1:8188
1313
DEPLOY_COMFYUI_DIR=/home/ComfyUI/web
1414

1515
# The directory containing the ComfyUI_examples repo used to extract test workflows.
16-
EXAMPLE_REPO_PATH=tests-ui/ComfyUI_examples
16+
EXAMPLE_REPO_PATH=tests-ui/ComfyUI_examples
17+
18+
# Whether to enable minification of the frontend code.
19+
ENABLE_MINIFY=true

vite.config.mts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dotenv from "dotenv";
55
dotenv.config();
66

77
const IS_DEV = process.env.NODE_ENV === 'development';
8+
const SHOULD_MINIFY = process.env.ENABLE_MINIFY !== 'false';
89

910
interface ShimResult {
1011
code: string;
@@ -111,7 +112,7 @@ export default defineConfig({
111112
comfyAPIPlugin(),
112113
],
113114
build: {
114-
minify: 'esbuild',
115+
minify: SHOULD_MINIFY ? 'esbuild' : false,
115116
target: 'es2015',
116117
sourcemap: true,
117118
rollupOptions: {
@@ -123,8 +124,8 @@ export default defineConfig({
123124
esbuild: {
124125
minifyIdentifiers: false,
125126
keepNames: true,
126-
minifySyntax: true,
127-
minifyWhitespace: true,
127+
minifySyntax: SHOULD_MINIFY,
128+
minifyWhitespace: SHOULD_MINIFY,
128129
},
129130
define: {
130131
'__COMFYUI_FRONTEND_VERSION__': JSON.stringify(process.env.npm_package_version),

0 commit comments

Comments
 (0)