build(projects): add vite plugin @soybeanjs/router-page

This commit is contained in:
Soybean
2022-11-07 18:47:44 +08:00
parent 288d586dbc
commit 40c1e13b50
6 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
import routerPage from '@soybeanjs/router-page';
export default function createSoybeanjsPlugin() {
return routerPage({
pagesFormatter: names => {
/** 系统的内置路由该文件夹名称不作为RouteKey */
const SYSTEM_VIEW = 'system-view';
const result = names
.filter(name => name !== SYSTEM_VIEW)
.map(name => {
return name.replace(`${SYSTEM_VIEW}_`, '');
});
return result;
}
});
}