# @ice/plugin-icestark

> Easy use `icestark` in icejs.

Latest version **1.2.1** (published 2025-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ice/plugin-icestark
pnpm add @ice/plugin-icestark
yarn add @ice/plugin-icestark
bun add @ice/plugin-icestark
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; popular repo.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2025-04-14 |
| First published | 2022-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18615 |
| Author | ice-admin@alibaba-inc.com |
| Maintainers | answershuto, chenjun1011, sobear, clarkxia, rax-publisher, luhengchang228, linbudu |

## Links

- npm: https://www.npmjs.com/package/@ice/plugin-icestark
- Repository: https://github.com/alibaba/ice.git#master
- Homepage: https://github.com/alibaba/ice/tree/master#readme
- Issues: https://github.com/alibaba/ice/issues
- npm.io page: https://npm.io/package/@ice/plugin-icestark

## Dependencies (2)

- [@ice/stark](https://npm.io/package/@ice/stark.md) ^2.7.4
- [@ice/stark-app](https://npm.io/package/@ice/stark-app.md) ^1.2.0

## Recent versions

- 1.2.1 (latest) — 2025-04-14
- 1.2.0-canary-478120d-20250409030159 (canary) — 2025-04-09
- 1.1.0-beta.0 (beta) — 2023-04-25
- 1.0.5-alpha.1 (alpha) — 2023-03-23
- 1.2.0 — 2025-04-09
- 1.2.0-canary-2f73084d6-20250409024615 — 2025-04-09
- 1.2.0-canary-2f73084-20250409023108 — 2025-04-09
- 1.2.0-canary-295e926ad-20250401061113 — 2025-04-01
- 1.2.0-canary-8a6a2e789-20250401060415 — 2025-04-01
- 1.2.0-canary-75b0f26bc-20250327065138 — 2025-03-27
- 1.2.0-canary-8993abc34-20250327060757 — 2025-03-27
- 1.2.0-canary-fe24502af-20250327040141 — 2025-03-27
- 1.2.0-canary-6ca298840-20250327035219 — 2025-03-27
- 1.2.0-canary-23dbf34ed-20250327032932 — 2025-03-27
- 1.2.0-canary-743122b9a-20250325121812 — 2025-03-25
- … 28 more at https://npm.io/package/@ice/plugin-icestark/versions

## README

# plugin-icestark

> Easy use [`icestark`](https://github.com/ice-lab/icestark) in [icejs](https://github.com/alibaba/ice).

## Usage

### Install

```bash
npm i -D @ice/plugin-icestark
```

### Framework Application

Configurate plugin to your `ice.config.mts`:

```ts title="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.

```ts title="src/app.ts"
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`:

```ts title="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`:

```ts title="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

---
_Source: https://npm.io/package/@ice/plugin-icestark · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
