mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 12:12:01 +08:00
refactor: refactor the project to solve the hot update problem caused by circular dependencies close #301
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import type { GlobEnvConfig } from '/#/config';
|
||||
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
import { warn } from '/@/utils/log';
|
||||
import pkg from '../../package.json';
|
||||
import { getConfigFileName } from '../../build/getConfigFileName';
|
||||
|
||||
export function getCommonStoragePrefix() {
|
||||
const globSetting = useGlobSetting();
|
||||
return `${globSetting.shortName}__${getEnv()}`.toUpperCase();
|
||||
const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig();
|
||||
return `${VITE_GLOB_APP_SHORT_NAME}__${getEnv()}`.toUpperCase();
|
||||
}
|
||||
|
||||
// Generate cache key according to version
|
||||
@@ -21,7 +21,27 @@ export function getAppEnvConfig() {
|
||||
? // Get the global configuration (the configuration will be extracted independently when packaging)
|
||||
((import.meta.env as unknown) as GlobEnvConfig)
|
||||
: window[ENV_NAME as any]) as unknown) as GlobEnvConfig;
|
||||
return ENV;
|
||||
|
||||
const {
|
||||
VITE_GLOB_APP_TITLE,
|
||||
VITE_GLOB_API_URL,
|
||||
VITE_GLOB_APP_SHORT_NAME,
|
||||
VITE_GLOB_API_URL_PREFIX,
|
||||
VITE_GLOB_UPLOAD_URL,
|
||||
} = ENV;
|
||||
|
||||
if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||
warn(
|
||||
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
|
||||
);
|
||||
}
|
||||
return {
|
||||
VITE_GLOB_APP_TITLE,
|
||||
VITE_GLOB_API_URL,
|
||||
VITE_GLOB_APP_SHORT_NAME,
|
||||
VITE_GLOB_API_URL_PREFIX,
|
||||
VITE_GLOB_UPLOAD_URL,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user