A micro frontend solution based on single-spa and module federation
npm install single-spa-mf
Do not edit this file. It is a report generated by API Extractor.
import { LifeCycles } from 'single-spa';
import { registerApplication } from 'single-spa';
// @public (undocumented)
export type AsyncFunction = (app: MFApp) => Promise<void> | void;
// @public (undocumented)
const getMFAppConfig: ({ app }: {
app: string;
}) => {
name: string;
filename: string;
};
// @public (undocumented)
const getMFExposes: (mod: string) => {
Single_SPA_MF_main: string;
};
// @public (undocumented)
export interface MFApp {
// (undocumented)
activeWhen: SingleSpaConfig['activeWhen'];
// (undocumented)
afterLoad?: AsyncFunction;
app?: (e: {
name: string;
}) => Promise<LifeCycles<any>>;
// (undocumented)
beforeLoad?: AsyncFunction;
// (undocumented)
customProps?: SingleSpaConfig['customProps'];
entry?: (e: {
name: string;
entryName: string;
}) => string | Promise<string>;
// (undocumented)
error?: MFAppHandle;
// (undocumented)
loader?: MFAppHandle;
// (undocumented)
name: string;
}
// @public (undocumented)
export interface MFAppHandle {
// (undocumented)
mount: (el: HTMLElement) => Promise<void> | void;
// (undocumented)
unmount: (el: HTMLElement) => Promise<void> | void;
}
// @public (undocumented)
export function registerMFApplications(appArray: MFApp[]): void;
// @public (undocumented)
export type SingleSpaConfig = Parameters<typeof registerApplication>[0];
declare namespace webpack {
export {
getMFAppConfig,
getMFExposes
}
}
export { webpack }
export * from "single-spa";
// (No @packageDocumentation comment for this package)
react + react-router + tailwindcss + single-spa + module federation + pnpm8
nvm install 18.17.0
corepack enable
pnpm i
pnpm start
main app: http://localhost:3001/
app1: http://localhost:3002/