Skip to content

Commit

Permalink
chore(projects): add switch for pageRoute plugin [添加自动生成路由的插件的开关]
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed May 30, 2023
1 parent a252138 commit 780ac75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_HTTP_PROXY=Y
VITE_SOYBEAN_ROUTE_PLUGIN=Y
6 changes: 4 additions & 2 deletions build/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin
...unplugin(viteEnv),
unocss(),
mock(viteEnv),
progress(),
pageRoute()
progress()
];

if (viteEnv.VITE_VISUALIZER === 'Y') {
Expand All @@ -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;
}
2 changes: 2 additions & 0 deletions src/typings/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit 780ac75

Please sign in to comment.