Make dev server target configurable (#79)

This commit is contained in:
Chenlei Hu
2024-07-02 12:26:14 -04:00
committed by GitHub
parent da4f48c9be
commit 38fdd19e5a
2 changed files with 10 additions and 1 deletions

7
.env_example Normal file
View File

@@ -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

View File

@@ -1,6 +1,8 @@
import { defineConfig, Plugin } from 'vite'; import { defineConfig, Plugin } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy' import { viteStaticCopy } from 'vite-plugin-static-copy'
import path from 'path'; import path from 'path';
import dotenv from "dotenv";
dotenv.config();
const IS_DEV = process.env.NODE_ENV === 'development'; const IS_DEV = process.env.NODE_ENV === 'development';
@@ -80,7 +82,7 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/api': { '/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 // Return empty array for extensions API as these modules
// are not on vite's dev server. // are not on vite's dev server.
bypass: (req, res, options) => { bypass: (req, res, options) => {