From 0347c83620df676fb02790c13b3304104b4e0e71 Mon Sep 17 00:00:00 2001 From: xiaoWangSec <124417044+xiaoWangSec@users.noreply.github.com> Date: Wed, 24 May 2023 16:42:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DVITE=5FGLOB=5FAPP=5FTI?= =?UTF-8?q?TLE=E4=B8=AD=E4=B8=8D=E8=83=BD=E5=AD=98=E5=9C=A8-=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98#1522=20(#2794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #1522 fix #1522 * fix #1522 fix #1522 * fix #1522 fix #1522 --- internal/vite-config/src/plugins/appConfig.ts | 2 +- src/hooks/setting/index.ts | 2 +- src/utils/env.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/vite-config/src/plugins/appConfig.ts b/internal/vite-config/src/plugins/appConfig.ts index a98b0416..c114ba40 100644 --- a/internal/vite-config/src/plugins/appConfig.ts +++ b/internal/vite-config/src/plugins/appConfig.ts @@ -28,7 +28,7 @@ async function createAppConfigPlugin({ name: PLUGIN_NAME, async configResolved(_config) { let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; - appTitle = appTitle.replace(/\s/g, '_'); + appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); publicPath = _config.base; source = await getConfigSource(appTitle); }, diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index 6a49893c..2f0db3ad 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -10,7 +10,7 @@ export const useGlobSetting = (): Readonly => { const glob: Readonly = { title: VITE_GLOB_APP_TITLE, apiUrl: VITE_GLOB_API_URL, - shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_'), + shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_').replace(/-/g, '_'), urlPrefix: VITE_GLOB_API_URL_PREFIX, uploadUrl: VITE_GLOB_UPLOAD_URL, }; diff --git a/src/utils/env.ts b/src/utils/env.ts index 3a51ad16..16af4f85 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -2,7 +2,7 @@ import type { GlobEnvConfig } from '/#/config'; import pkg from '../../package.json'; const getVariableName = (title: string) => { - return `__PRODUCTION__${title.replace(/\s/g, '_') || '__APP'}__CONF__` + return `__PRODUCTION__${title.replace(/\s/g, '_').replace(/-/g, '_') || '__APP'}__CONF__` .toUpperCase() .replace(/\s/g, ''); };