ice/packages/plugin-icestark
ClarkXia 3a99b620cf
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
Coverage / coverage (16.x) (push) Has been cancelled Details
Release / Release (16) (push) Has been cancelled Details
chore: update plugin option type of plugin-icestark (#7079)
2025-04-14 20:07:42 +08:00
..
src chore: update plugin option type of plugin-icestark (#7079) 2025-04-14 20:07:42 +08:00
CHANGELOG.md chore: update plugin option type of plugin-icestark (#7079) 2025-04-14 20:07:42 +08:00
Context.d.ts Feat: enhance plugin icestark and refactor webpack bundle exports (#7068) 2025-04-09 10:27:46 +08:00
README.md feat: plugin for icestark (#5695) 2022-12-15 14:35:07 +08:00
package.json chore: update plugin option type of plugin-icestark (#7079) 2025-04-14 20:07:42 +08:00
runtime.d.ts fix: import path of types and runtime (#5981) 2023-02-28 15:08:10 +08:00
tsconfig.json feat: plugin for icestark (#5695) 2022-12-15 14:35:07 +08:00
types.d.ts fix: import path of types and runtime (#5981) 2023-02-28 15:08:10 +08:00

README.md

plugin-icestark

Easy use icestark in icejs.

Usage

Install

npm i -D @ice/plugin-icestark

Framework Application

Configurate plugin to your ice.config.mts:

import { defineConfig } from '@ice/app';
import icestark from '@ice/plugin-icestark';

export default defineConfig(() => ({
  plugins: [
    icestark({ type: 'framework' }),
  ],
}));

Through export icestark configuration of your framework application.

import { defineFrameworkConfig } from '@ice/plugin-icestark/esm/types';

export const icestark = defineFrameworkConfig(() => ({
  getApps: () => ([]),
}));

Options:

  • getApps: get sub-application information, support async function
  • appRouter
    • ErrorComponent: error component
    • LoadingComponent: loading component
    • NotFoundComponent: 404 not found component
    • shouldAssetsRemove: check assets if it should be removed
  • layout: specify Framework application Layout

Sub-application

Configurate plugin to your ice.config.mts:

import { defineConfig } from '@ice/app';
import icestark from '@ice/plugin-icestark';

export default defineConfig(() => ({
  plugins: [
    icestark({ type: 'child' }),
  ],
}));

modify icestark exports in src/app.ts:

// app.ts
import { defineChildConfig } from '@ice/plugin-icestark/esm/types';

export const icestark = defineChildConfig(() => ({
  mount: () => {},
  unmount: () => {},
}));

Options:

  • mount: excute before Sub-application mounted
  • unmount: excute after Sub-application unmounted