From 160906bf47d006e43523ed79a9aab2fa1b681269 Mon Sep 17 00:00:00 2001 From: Pinghao Wu Date: Wed, 8 May 2024 22:55:16 +0800 Subject: [PATCH] move apiserver proxy detection out of bundle vite runtime url rendering has changed that it is evalutated before everything on production bundle, so let's just be safer and move the prerequisite out of bundle we loss typescript tooling on this little bit of code, guess that just the price need to be paid fixes production bundle after vite 5.2.9 See: https://github.com/vitejs/vite/pull/16184 --- index.html | 9 +++++++++ src/router/index.ts | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index c227a0e..718e9aa 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,15 @@ Sparkles +
diff --git a/src/router/index.ts b/src/router/index.ts index 4fcb747..d8c8412 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,14 +12,6 @@ declare global { } } -const dns1123LabelFmt = '[a-z0-9]([-a-z0-9]*[a-z0-9])?'; -const dns1123SubdomainFmt = `${dns1123LabelFmt}(\\.${dns1123LabelFmt})*`; -// TODO IANA_SVC_NAME/integer validation -const schemeNamePort = `((https?|):)?${dns1123SubdomainFmt}(:[^:/]*)?`; -const apiserverProxyRegex = new RegExp(`^/api/v1/namespaces/${dns1123SubdomainFmt}/(pods|services)/${schemeNamePort}/proxy/`); -const m = window.location.pathname.match(apiserverProxyRegex); -window.__base_url = m === null ? import.meta.env.BASE_URL : m[0]; - const checkNamespacedResourcePermission = (group: string, resource: string) => computedAsync(async () => { const { selectedNamespace } = storeToRefs(useNamespaces());