mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 07:43:42 +08:00 
			
		
		
		
	Merge pull request #54 from pany-ang/main
fix(projects): 修复 BASE_URL 没有生效的问题
This commit is contained in:
		@@ -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)),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user