fix(projects): 修复 BASE_URL 没有生效的问题
This commit is contained in:
parent
1e2fdda090
commit
72d7dcfa5e
@ -8,7 +8,7 @@ import { createRouterGuard } from './guard';
|
||||
const createHistoryFunc = import.meta.env.VITE_IS_VERCEL === '1' ? createWebHashHistory : createWebHistory;
|
||||
|
||||
export const router = createRouter({
|
||||
history: createHistoryFunc(import.meta.env.BASE_URL),
|
||||
history: createHistoryFunc(import.meta.env.VITE_APP_BASE_URL),
|
||||
routes: transformAuthRoutesToVueRoutes(constantRoutes),
|
||||
scrollBehavior
|
||||
});
|
||||
|
2
src/typings/common/env.d.ts
vendored
2
src/typings/common/env.d.ts
vendored
@ -9,7 +9,7 @@ declare module '*.vue' {
|
||||
|
||||
interface ImportMetaEnv {
|
||||
/** 项目基本地址 */
|
||||
readonly BASE_URL: string;
|
||||
readonly VITE_APP_BASE_URL: string;
|
||||
/** 项目名称 */
|
||||
readonly VITE_APP_NAME: string;
|
||||
/** 项目标题 */
|
||||
|
@ -6,7 +6,7 @@ export default defineConfig(configEnv => {
|
||||
const viteEnv = loadEnv(configEnv.mode, `.env.${configEnv.mode}`);
|
||||
|
||||
return {
|
||||
base: viteEnv.BASE_URL,
|
||||
base: viteEnv.VITE_APP_BASE_URL,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
|
Loading…
Reference in New Issue
Block a user