diff --git a/.env.development b/.env.development index 840974629..d123065a3 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ VITE_HTTP_PROXY=Y +VITE_SOYBEAN_ROUTE_PLUGIN=Y diff --git a/build/plugins/index.ts b/build/plugins/index.ts index c53d18f23..d26afbeaf 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -25,8 +25,7 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin ...unplugin(viteEnv), unocss(), mock(viteEnv), - progress(), - pageRoute() + progress() ]; if (viteEnv.VITE_VISUALIZER === 'Y') { @@ -38,6 +37,9 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin if (viteEnv.VITE_PWA === 'Y' || viteEnv.VITE_VERCEL === 'Y') { plugins.push(pwa()); } + if (viteEnv.VITE_SOYBEAN_ROUTE_PLUGIN === 'Y') { + plugins.push(pageRoute()); + } return plugins; } diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts index f35b005d8..6f5d15bf2 100644 --- a/src/typings/env.d.ts +++ b/src/typings/env.d.ts @@ -66,6 +66,8 @@ interface ImportMetaEnv { readonly VITE_PROD_MOCK?: 'Y' | 'N'; /** hash路由模式 */ readonly VITE_HASH_ROUTE?: 'Y' | 'N'; + /** 是否应用自动生成路由的插件 */ + readonly VITE_SOYBEAN_ROUTE_PLUGIN?: 'Y' | 'N'; /** 是否是部署的vercel */ readonly VITE_VERCEL?: 'Y' | 'N'; }