From 780ac75bf6e922f4994d5c7464844f15d1cf4418 Mon Sep 17 00:00:00 2001 From: Soybean Date: Wed, 31 May 2023 01:52:57 +0800 Subject: [PATCH] =?UTF-8?q?chore(projects):=20add=20switch=20for=20pageRou?= =?UTF-8?q?te=20plugin=20[=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=B7=AF=E7=94=B1=E7=9A=84=E6=8F=92=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=BC=80=E5=85=B3]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + build/plugins/index.ts | 6 ++++-- src/typings/env.d.ts | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.env.development b/.env.development index 84097462..d123065a 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 c53d18f2..d26afbea 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 f35b005d..6f5d15bf 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'; }