Object
需要先通过 pnpm run new
启用「微前端」 功能。
import { appTools, defineConfig } from '@modern-js/app-tools';
import { garfishPlugin } from '@modern-js/plugin-garfish';
export default defineConfig({
runtime: {
router: true,
masterApp: {
apps: [{
name: 'Table',
entry: 'http://localhost:8081',
// activeWhen: '/table'
}, {
name: 'Dashboard',
entry: 'http://localhost:8082'
// activeWhen: '/dashboard'
}]
},
},
plugins: [appTools(), garfishPlugin()],
});
interface Manifest {
getAppList?: () => Array<AppInfo>;
}
通过 getAppList
配置,可以自定义如何获取远程列表数据
type GetAppList = () => Promise<Array<AppInfo>>;
当 apps
为对象类型的时候,表示子应用模块的信息 Array<AppInfo>
interface AppInfo {
name: string;
entry: string;
activeWhen?: string | ()=> boolean;
}
在 masterApp
配置下,开发者可以透传 Garfish 的配置项。
所有支持的配置项点此查看。