mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
build(projects): 添加vercel打包的环境
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
import type { App } from 'vue';
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
|
||||
import { transformAuthRoutesToVueRoutes } from '@/utils';
|
||||
import { constantRoutes } from './routes';
|
||||
import { createRouterGuard } from './guard';
|
||||
|
||||
const createHistoryFunc = import.meta.env.VITE_IS_VERCEL === '1' ? createWebHashHistory : createWebHistory;
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
history: createHistoryFunc(import.meta.env.BASE_URL),
|
||||
routes: transformAuthRoutesToVueRoutes(constantRoutes),
|
||||
scrollBehavior: () => ({ left: 0, top: 0 })
|
||||
});
|
||||
|
2
src/typings/common/env.d.ts
vendored
2
src/typings/common/env.d.ts
vendored
@ -18,6 +18,8 @@ interface ImportMetaEnv {
|
||||
readonly VITE_APP_DESC: string;
|
||||
/** 网路请求环境类型 */
|
||||
readonly VITE_HTTP_ENV: Service.HttpEnv;
|
||||
/** 是否是部署vercel */
|
||||
readonly VITE_IS_VERCEL?: '1';
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
Reference in New Issue
Block a user