Core plugin functionality for configuring Ice.js applications as framework or child applications in a micro-frontends setup.
The main plugin factory function that configures Ice.js applications for micro-frontends support.
/**
* Main plugin factory function for Ice.js micro-frontends integration
* @param options - Plugin configuration options
* @returns Plugin instance configured for Ice.js
*/
declare function icestark(options: PluginOptions): Plugin;
interface PluginOptions {
/** Type of application: 'framework' for parent apps, 'child' for sub-apps */
type: 'child' | 'framework';
/** Library name for UMD exports when type is 'child' (optional) */
library?: string | string[];
}Usage Examples:
import { defineConfig } from '@ice/app';
import icestark from '@ice/plugin-icestark';
// Framework application configuration
export default defineConfig(() => ({
plugins: [
icestark({ type: 'framework' }),
],
}));
// Child application configuration with custom library name
export default defineConfig(() => ({
plugins: [
icestark({
type: 'child',
library: 'MySubApp'
}),
],
}));The plugin identifier string used internally by the plugin system.
/**
* Plugin identifier constant
*/
declare const PLUGIN_NAME: '@ice/plugin-icestark';When configured with type: 'framework', the plugin:
When configured with type: 'child', the plugin:
For child applications, the library name is resolved in this order:
library optioncontext.pkg.name'microApp'The library name is used for:
When configured with type: 'child', the plugin automatically generates these lifecycle functions for micro-frontend compatibility:
/**
* Bootstrap lifecycle function (qiankun compatibility)
* Automatically generated - calls user's bootstrap method if defined
*/
export async function bootstrap(props: any): Promise<void>;
/**
* Mount lifecycle function
* Automatically generated - handles React root creation and calls user's mount method
*/
export async function mount(props: any): Promise<void>;
/**
* Unmount lifecycle function
* Automatically generated - handles React root cleanup and calls user's unmount method
*/
export async function unmount(props: any): Promise<void>;These functions are automatically added to the child application's entry point and handle: