From cf14c443545f44d7512a8da7a8fdbe98833c88a9 Mon Sep 17 00:00:00 2001 From: jacovinus Date: Wed, 10 Jan 2024 17:29:24 +0100 Subject: [PATCH] fix: custom base app url --- .gitignore | 3 ++- packages/main/.env | 3 ++- packages/main/src/main.tsx | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 83f000cf..941bcae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules/* -dist \ No newline at end of file +dist +server \ No newline at end of file diff --git a/packages/main/.env b/packages/main/.env index 816f33fa..9e943cda 100644 --- a/packages/main/.env +++ b/packages/main/.env @@ -1,2 +1,3 @@ VITE_API_URL= -VITE_APP_VERSION= \ No newline at end of file +VITE_APP_VERSION= +VITE_APP_BASE_URL=/ \ No newline at end of file diff --git a/packages/main/src/main.tsx b/packages/main/src/main.tsx index 91349e0d..33d277c7 100644 --- a/packages/main/src/main.tsx +++ b/packages/main/src/main.tsx @@ -31,6 +31,10 @@ const UserRoles = lazy(() => import("../views/User/UserRoles")); errorInterceptor(axios); +const base = document.createElement('base') +base.href = import.meta.env.VITE_APP_BASE_URL || "/" +document.head.insertBefore(base, document.head.firstChild) + ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(