mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-23 23:39:47 +08:00
build(projects): add vite plugin @soybeanjs/router-page
This commit is contained in:
@ -9,13 +9,24 @@ import unplugin from './unplugin';
|
||||
import mock from './mock';
|
||||
import visualizer from './visualizer';
|
||||
import compress from './compress';
|
||||
import soybeanjs from './soybeanjs';
|
||||
|
||||
/**
|
||||
* vite插件
|
||||
* @param viteEnv - 环境变量配置
|
||||
*/
|
||||
export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | PluginOption[])[] {
|
||||
const plugins = [vue(), vueJsx(), VitePWA(), html(viteEnv), ...unplugin(viteEnv), unocss(), mock, progress()];
|
||||
const plugins = [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
VitePWA(),
|
||||
html(viteEnv),
|
||||
...unplugin(viteEnv),
|
||||
unocss(),
|
||||
mock,
|
||||
progress(),
|
||||
soybeanjs()
|
||||
];
|
||||
|
||||
if (viteEnv.VITE_VISUALIZER === 'Y') {
|
||||
plugins.push(visualizer as PluginOption);
|
||||
|
18
build/plugins/soybeanjs.ts
Normal file
18
build/plugins/soybeanjs.ts
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user