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, ''); };