or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

child-applications.mdcontext-utilities.mdframework-applications.mdindex.mdplugin-configuration.md
tile.json

plugin-configuration.mddocs/

Plugin Configuration

Core plugin functionality for configuring Ice.js applications as framework or child applications in a micro-frontends setup.

Capabilities

Main Plugin Function

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'
    }),
  ],
}));

Plugin Name Constant

The plugin identifier string used internally by the plugin system.

/**
 * Plugin identifier constant
 */
declare const PLUGIN_NAME: '@ice/plugin-icestark';

Configuration Behavior

Framework Mode

When configured with type: 'framework', the plugin:

  • Disables SSR and SSG (not yet supported)
  • Sets up the framework runtime for managing sub-applications
  • Configures routing and layout management

Child Mode

When configured with type: 'child', the plugin:

  • Configures webpack output for UMD module format
  • Sets the library name (defaults to package name or 'microApp')
  • Modifies the render function to support dynamic basename
  • Adds lifecycle methods for qiankun and icestark compatibility
  • Generates bootstrap, mount, and unmount functions automatically

Library Name Resolution

For child applications, the library name is resolved in this order:

  1. Provided library option
  2. Package name from context.pkg.name
  3. Default fallback: 'microApp'

The library name is used for:

  • Webpack UMD output configuration
  • Window global variable name
  • icestark library identification

Generated Lifecycle Functions

Child Application Lifecycle

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:

  • Integration with icestark and qiankun micro-frontend frameworks
  • React root creation and destruction
  • Container resolution and management
  • User-defined lifecycle method invocation
  • Library name registration in global scope