build(projects): 添加构建打包的不同环境配置

This commit is contained in:
Soybean
2021-09-01 18:29:34 +08:00
parent 78a28a4576
commit ef57d9e6a9
3 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router';
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
import type { App } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
import { customRoutes } from './routes';
@ -6,8 +6,10 @@ import createRouterGuide from './permission';
const routes: Array<RouteRecordRaw> = [...customRoutes];
const isVercel = import.meta.env.VITE_HTTP_ENV === 'VERCEL';
export const router = createRouter({
history: createWebHistory(),
history: isVercel ? createWebHashHistory() : createWebHistory(),
routes
});