From b67658760fd40f026fec35bc4f882711ad49b1ab Mon Sep 17 00:00:00 2001 From: Luv Kapur Date: Wed, 9 Jul 2025 14:32:38 -0400 Subject: [PATCH 1/2] fix hmr proxy issue --- scopes/ui-foundation/ui/ui-server.ts | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/scopes/ui-foundation/ui/ui-server.ts b/scopes/ui-foundation/ui/ui-server.ts index c0f3facdf065..c12d6436bac3 100644 --- a/scopes/ui-foundation/ui/ui-server.ts +++ b/scopes/ui-foundation/ui/ui-server.ts @@ -55,7 +55,7 @@ export class UIServer { private logger: Logger, private publicDir: string, private plugins: StartPlugin[] - ) { } + ) {} getName() { return this.uiRoot.name; @@ -111,7 +111,7 @@ export class UIServer { context: [hmrRoute], target: `ws://${this.host}:${server.port}`, ws: true, - } + }, ]; if (this._proxyRoutes.has(previewRoute) || this._proxyRoutes.has(hmrRoute)) { @@ -131,11 +131,13 @@ export class UIServer { const reqUrl = req.url?.replace(/\?.+$/, '') || ''; const path = stripTrailingChar(reqUrl, '/'); - const entry = entries.find((proxy) => - proxy.ws && proxy.context.some(item => { - const itemPath = stripTrailingChar(item, '/'); - return path === itemPath || path.startsWith(itemPath); - }) + const entry = entries.find( + (proxy) => + proxy.ws && + proxy.context.some((item) => { + const itemPath = stripTrailingChar(item, '/'); + return path === itemPath || path.startsWith(itemPath); + }) ); if (!entry) { @@ -207,9 +209,7 @@ export class UIServer { const reqUrl = req.url?.replace(/\?.+$/, '') || ''; const path = stripTrailingChar(reqUrl, '/'); const proxyEntries = this.getProxyFromPlugins(); - const entry = proxyEntries.find((proxy) => - proxy.context.some((item) => item === stripTrailingChar(path, '/')) - ); + const entry = proxyEntries.find((proxy) => proxy.context.some((item) => item === stripTrailingChar(path, '/'))); if (!entry) { return; } @@ -315,11 +315,6 @@ export class UIServer { target: `http://${this.host}:${port}`, changeOrigin: true, }, - { - context: ['/_hmr'], - target: `ws://${this.host}:${port}`, - ws: true, - } ]; const gqlProxies: ProxyEntry[] = [ From 968044430f799fbe8b40141b581339e3693916b0 Mon Sep 17 00:00:00 2001 From: Luv Kapur Date: Wed, 9 Jul 2025 14:37:34 -0400 Subject: [PATCH 2/2] formatting fixes --- scopes/ui-foundation/ui/ui-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/ui-foundation/ui/ui-server.ts b/scopes/ui-foundation/ui/ui-server.ts index c12d6436bac3..4a7bcfac724f 100644 --- a/scopes/ui-foundation/ui/ui-server.ts +++ b/scopes/ui-foundation/ui/ui-server.ts @@ -55,7 +55,7 @@ export class UIServer { private logger: Logger, private publicDir: string, private plugins: StartPlugin[] - ) {} + ) { } getName() { return this.uiRoot.name;