npm.io
0.0.14 • Published 4 years ago

single-spa-mf

Licence
—
Version
0.0.14
Deps
2
Size
16 kB
Vulns
0
Weekly
0
Stars
16

single-spa-mf

A micro frontend solution based on single-spa and module federation

NPM version NPM downloads

yarn add single-spa-mf

API

single-spa-mf
import { registerApplication, LifeCycles } from 'single-spa';
import * as webpack from './webpack';
export { webpack };
export interface MFAppHandle {
    mount: (el: HTMLElement) => Promise<void> | void;
    unmount: (el: HTMLElement) => Promise<void> | void;
}
declare type SingleSpaConfig = Parameters<typeof registerApplication>[0];
export interface MFApp {
    name: string;
    activeWhen: SingleSpaConfig['activeWhen'];
    /** main app module */
    app?: (e: {
        name: string;
    }) => Promise<LifeCycles<any>>;
    /** app entry url */
    entry?: (e: {
        name: string;
        entryName: string;
    }) => string | Promise<string>;
    customProps?: SingleSpaConfig['customProps'];
    loader?: MFAppHandle;
    error?: MFAppHandle;
}
export declare function registerMFApplications(appArray: MFApp[]): void;
export * from 'single-spa';
single-spa-mf/webpack
export declare const getMFAppConfig: ({ app }: {
    app: string;
}) => {
    name: string;
    filename: string;
};
export declare const getMFExposes: (mod: string) => {
    [x: string]: string;
};
demo

https://github.com/yiminghe/single-spa-mf