From c42e51b6f925ebfabf57278785606bccf4338499 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:15:33 +0100 Subject: [PATCH] Infer server port only in dev env --- src/lib/DefaultPromiseErrorHandler.ts | 2 +- src/lib/requests/client/BaseClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/DefaultPromiseErrorHandler.ts b/src/lib/DefaultPromiseErrorHandler.ts index 96131f93..6a9c3740 100644 --- a/src/lib/DefaultPromiseErrorHandler.ts +++ b/src/lib/DefaultPromiseErrorHandler.ts @@ -7,7 +7,7 @@ */ export const defaultPromiseErrorHandler = (name: string) => (error: any) => { - if (process.env.NODE_ENV === 'production') { + if (import.meta.env.PROD) { return; } diff --git a/src/lib/requests/client/BaseClient.ts b/src/lib/requests/client/BaseClient.ts index 2929f8a4..6b5855b1 100644 --- a/src/lib/requests/client/BaseClient.ts +++ b/src/lib/requests/client/BaseClient.ts @@ -17,7 +17,7 @@ export abstract class BaseClient { const { hostname, port, protocol } = window.location; // if port is 3000 it's probably running from webpack development server - const inferredPort = port === '3000' ? '4567' : port; + const inferredPort = import.meta.env.DEV && port === '3000' ? '4567' : port; return AppStorage.local.getItemParsed('serverBaseURL', `${protocol}//${hostname}:${inferredPort}`); }