fix: 修复VITE_GLOB_APP_TITLE中不能存在-的问题#1522 (#2794)
* fix #1522 fix #1522 * fix #1522 fix #1522 * fix #1522 fix #1522
This commit is contained in:
parent
eb0fdb2cfc
commit
0347c83620
|
|
@ -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);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
|
|||
const glob: Readonly<GlobConfig> = {
|
||||
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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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, '');
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue