mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	build(projects): 添加构建打包的不同环境配置
This commit is contained in:
		
							
								
								
									
										1
									
								
								.env.vercel
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.env.vercel
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
VITE_HTTP_ENV=VERCEL
 | 
			
		||||
@@ -3,7 +3,11 @@
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "dev": "vite",
 | 
			
		||||
    "dev:prod": "vite --mode production",
 | 
			
		||||
    "dev:vercel": "vite --mode vercel",
 | 
			
		||||
    "build": "vue-tsc --noEmit --skipLibCheck && vite build",
 | 
			
		||||
    "build:test": "vue-tsc --noEmit --skipLibCheck && vite build --mode development",
 | 
			
		||||
    "build:vercel": "vue-tsc --noEmit --skipLibCheck && vite build --mode vercel",
 | 
			
		||||
    "serve": "vite preview",
 | 
			
		||||
    "lint": "eslint ./src --ext .vue,.js,jsx,.ts,tsx",
 | 
			
		||||
    "lint:fix": "eslint --fix ./src --ext .vue,.js,jsx,.ts,tsx",
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user