Skip to content

Commit f52915a

Browse files
Allow disabling proxy of /template path via env (#3773)
1 parent 13b00cd commit f52915a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.env_example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ TEST_COMFYUI_DIR=/home/ComfyUI
1818

1919
# Whether to enable minification of the frontend code.
2020
ENABLE_MINIFY=true
21+
22+
# Whether to disable proxying the `/templates` route. If true, allows you to
23+
# serve templates from the ComfyUI_frontend/public/templates folder (for
24+
# locally testing changes to templates). When false or nonexistent, the
25+
# templates are served via the normal method from the server's python site
26+
# packages.
27+
DISABLE_TEMPLATES_PROXY=false

vite.config.mts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const IS_DEV = process.env.NODE_ENV === 'development'
1818
const SHOULD_MINIFY = process.env.ENABLE_MINIFY === 'true'
1919
// vite dev server will listen on all addresses, including LAN and public addresses
2020
const VITE_REMOTE_DEV = process.env.VITE_REMOTE_DEV === 'true'
21+
const DISABLE_TEMPLATES_PROXY = process.env.DISABLE_TEMPLATES_PROXY === 'true'
2122

2223
const DEV_SERVER_COMFYUI_URL =
2324
process.env.DEV_SERVER_COMFYUI_URL || 'http://127.0.0.1:8188'
@@ -52,9 +53,13 @@ export default defineConfig({
5253
target: DEV_SERVER_COMFYUI_URL
5354
},
5455

55-
'/templates': {
56-
target: DEV_SERVER_COMFYUI_URL
57-
},
56+
...(!DISABLE_TEMPLATES_PROXY
57+
? {
58+
'/templates': {
59+
target: DEV_SERVER_COMFYUI_URL
60+
}
61+
}
62+
: {}),
5863

5964
'/testsubrouteindex': {
6065
target: 'http://localhost:5173',

0 commit comments

Comments
 (0)