From 38fdd19e5abddba5641c9532fe6e09729365dcec Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 2 Jul 2024 12:26:14 -0400 Subject: [PATCH] Make dev server target configurable (#79) --- .env_example | 7 +++++++ vite.config.mts | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .env_example diff --git a/.env_example b/.env_example new file mode 100644 index 000000000..d43edd000 --- /dev/null +++ b/.env_example @@ -0,0 +1,7 @@ +# Local development playwright target +PLAYWRIGHT_TEST_URL=http://localhost:5173 +# PLAYWRIGHT_TEST_URL=http://localhost:8188 + +# Proxy target of the local development server +# Note: localhost:8188 does not work. +DEV_SERVER_COMFYUI_URL=http://127.0.0.1:8188 diff --git a/vite.config.mts b/vite.config.mts index 508bf179f..87e5219d9 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -1,6 +1,8 @@ import { defineConfig, Plugin } from 'vite'; import { viteStaticCopy } from 'vite-plugin-static-copy' import path from 'path'; +import dotenv from "dotenv"; +dotenv.config(); const IS_DEV = process.env.NODE_ENV === 'development'; @@ -80,7 +82,7 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'http://127.0.0.1:8188', + target: process.env.DEV_SERVER_COMFYUI_URL || 'http://127.0.0.1:8188', // Return empty array for extensions API as these modules // are not on vite's dev server. bypass: (req, res, options) => {