Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)17k · #10799

qiankun

Skill này làm gì

Skill này giải thích cách xây dựng một ứng dụng host và các ứng dụng con nhỏ hơn được nạp vào lúc chạy bằng qiankun. Skill dành cho lập trình viên web muốn chia một giao diện frontend lớn thành nhiều phần.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo một ứng dụng chính nạp nhiều ứng dụng frontend riêng biệt.
  • ✓Khi bạn muốn biến một ứng dụng Vite hiện có thành một ứng dụng con micro.
  • ✓Khi bạn đang thiết lập việc nạp micro-frontend với React hoặc Vue.

Liên kết skill

https://github.com/umijs/qiankun/blob/next/skills/qiankun/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/umijs/qiankun/blob/next/skills/qiankun/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy giúp tôi biến ứng dụng Vite React hiện có thành một ứng dụng con qiankun mà một shell chính có thể nạp.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đọc hướng dẫn tương ứng với tác vụ, rồi làm theo các bước cho ứng dụng host hoặc ứng dụng con. Nó dùng các cổng cố định và tên ứng dụng khớp nhau để các phần có thể tìm thấy nhau.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

qiankun

qiankun is a micro-frontend framework: a main (host) app loads sub (micro) apps from their HTML entries at runtime, each inside a JS sandbox, with opt-in CSS isolation. This skill is the agent-facing manual for qiankun 3.x.

Task routing

Read only the reference file(s) the task at hand needs:

Task Read
Create a micro (sub) app, or convert an existing Vite app references/create-micro-app.md
Create a main (host) app references/create-main-app.md
Anything else — migration, style isolation, sandbox, debugging https://qiankun.umijs.org and examples/ in https://github.com/umijs/qiankun

Before you start

Determine these, asking the user only when not inferable from context:

  1. App type — main (host/shell) or sub (micro app).
  2. App name — lowercase letters, numbers, hyphens. The name the host registers must exactly match the name the sub app uses in its classic-mode fallback.
  3. Framework — React or Vue; TypeScript or JavaScript. Templates in the references are TS; strip types for JS.
  4. Dev port — must be fixed and unique per app, because the host hard-references it in entry. Convention: main app 7099, sub apps 7101, 7102, …

Package versions — until qiankun 3.0 stable ships, rc is the dist-tag for the core packages:

Package Dist-tag Goes in
qiankun rc main app dependencies
@qiankunjs/react / @qiankunjs/vue rc main app dependencies (optional UI binding)
@qiankunjs/bundler-plugin rc sub app devDependencies

Key facts

These invariants shape every task below:

  • Vite sub apps need no dedicated build mode. qiankun 3 loads <script type="module"> natively through its ESM sandbox — regular vite dev / vite build output is qiankun-ready as-is.
  • The JS sandbox is on by default. CSS isolation is opt-in per app via styleIsolation: true (runtime CSS @scope).
  • A sub app must stay runnable standalone: when not loaded by qiankun (window.__POWERED_BY_QIANKUN__ is undefined) it renders itself directly.
  • Always unmount what you mount. loadMicroApp returns a handle whose .unmount() must be called when the app leaves; the MicroApp component bindings do this automatically on component unmount. Unmounted instances stay cached for reuse by app name; only .unload() / unloadMicroApp(name) releases them, and the bindings never call those.
  • Webpack sub apps use @qiankunjs/bundler-plugin/webpack instead of the Vite plugin; see the docs.

After any creation task

Verify the result following the checklist at the end of the reference you used. If a browser tool is available, perform the checks yourself instead of asking the user to.

Câu hỏi thường gặp

Nó bao quát phiên bản nào?

Đây là hướng dẫn cho qiankun 3.x, và nó lưu ý rằng một số gói lõi dùng thẻ rc cho đến khi 3.0 ổn định được phát hành.

Nó có hỗ trợ Vue như React không?

Có. Skill bao gồm cả React và Vue, và các template của nó được viết bằng TypeScript.

Còn chuyển đổi hoặc gỡ lỗi thì sao?

Với các chủ đề vượt quá việc tạo ứng dụng chính và ứng dụng con, skill chỉ đến trang web chính thức và các ví dụ của qiankun.

Chi tiết

Mô tả gốc của tác giả

Usage manual for building micro-frontend projects with qiankun 3.x. Use when the user wants to create a qiankun main (host) app or sub (micro) app, convert an existing Vite app into a qiankun micro app, or wire up micro-frontend loading with React/Vue.

repo: umijs/qiankun

Độ phổ biến

Sao GitHub
17k
Vị trí xếp hạng
#10799
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Skill tương tự