From eb1f942c4a24ec1338f003211af7564beb8a7aeb Mon Sep 17 00:00:00 2001 From: Bilal MEDDAH Date: Mon, 23 Oct 2023 16:40:46 +0200 Subject: [PATCH 1/2] add base url at runtime --- index.html | 26 ++++----- package.json | 1 + server/constants.ts | 5 +- server/index.ts | 4 +- src/shared/hooks/usePlugins.ts | 1 - src/shared/lib.scss | 61 --------------------- vite.config.js | 14 +++-- yarn.lock | 99 +++++++++++++++++++++++++++++++++- 8 files changed, 127 insertions(+), 84 deletions(-) diff --git a/index.html b/index.html index 89160d134..fd7a3fcfc 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,18 @@ - - - - Nexus Fusion - - - -
- - - - + + + + Nexus Fusion + + + + +
+ + + + + \ No newline at end of file diff --git a/package.json b/package.json index 1f633ea7d..6bc182f88 100644 --- a/package.json +++ b/package.json @@ -210,6 +210,7 @@ "util": "^0.12.5", "vite": "^4.4.9", "vite-compatible-readable-stream": "^3.6.1", + "vite-plugin-dynamic-base": "^1.0.0", "vite-plugin-dynamic-import": "^1.5.0", "vitest": "^0.34.5" }, diff --git a/server/constants.ts b/server/constants.ts index be3396f23..d7210f233 100644 --- a/server/constants.ts +++ b/server/constants.ts @@ -122,8 +122,7 @@ LIMIT 1000`; const DEFAULT_SEARCH_CONFIG_PROJECT = 'webapps/nexus-web'; const DEFAULT_SERVICE_ACCOUNTS_REALM = 'serviceaccounts'; const rawBase = process.env.BASE_PATH || ''; -// to develop plugins locally, change PLUGINS_PATH to '/public/plugins' -const pluginsManifestPath = process.env.PLUGINS_MANIFEST_PATH || '/plugins'; +const pluginsManifestPath = process.env.PLUGINS_MANIFEST_PATH || `dist/plugins`; // configure instance logo const layoutSettings = { @@ -149,7 +148,7 @@ const searchSettings = { const dataModelsLocation = process.env.DATA_MODELS || ''; const subAppsManifestPath = - process.env.SUB_APPS_MANIFEST_PATH || '/public/sub-apps'; + process.env.SUB_APPS_MANIFEST_PATH || '/dist/sub-apps'; const base = rawBase.replace(/\/$/, ''); diff --git a/server/index.ts b/server/index.ts index 255f16b57..655969a3d 100644 --- a/server/index.ts +++ b/server/index.ts @@ -91,6 +91,9 @@ async function transformer(html: string, req: Request) { .replace( '', ` + ${helmet.title.toString()} ${helmet.meta.toString()} @@ -100,7 +103,6 @@ async function transformer(html: string, req: Request) { .replace( '', `