micro-panel-hub is a micro-frontend workspace library built with qiankun and flexlayout-react. It is published as the npm package @shupeixuan/micro-panel-hub for embedding into host applications. The host app does not have to be written with React, but the current implementation is still rendered internally with React and therefore requires react and react-dom at runtime.
Live preview of the demo app: https://shupx.github.io/micro-panel-hub/
Note: qiankun only supports sub app built with webpack, not vite!
This repository is managed as a pnpm workspace monorepo:
- packages/micro-panel-hub: the publishable library package
- packages/demo-use-micro-panel-hub: the Vite demo host app that consumes the library
The library package itself still contains:
main-app/: the main source implementation for the exported library APIsub-app-demo/: the built-in sample micro app used by the library and demolib/: the publishable package output
The workspace now uses two different modes on purpose:
- Development: the demo app resolves
@shupeixuan/micro-panel-hubto library source code through webpack alias, so library edits take effect immediately without rebuildinglib - Build and publish: the library is built first and outputs
lib/, then the demo build consumes the built package output
This keeps local iteration fast while preserving a clean npm publish flow.
More explicitly:
pnpm dev:packages/demo-use-micro-panel-hubusespackages/micro-panel-hub/main-app/src/through Vite alias, so this mode validates source-level behavior and fast local integrationpnpm build:packages/micro-panel-hubbuildslib/first, thenpackages/demo-use-micro-panel-hubbuilds in production mode without the source alias, so this mode validates the packaged library output
Install dependencies once from the repository root:
pnpm installStart development:
pnpm devThis runs the demo host app together with the library-side demo micro app build/watch flow.
It does not build packages/micro-panel-hub/lib/ as part of the normal dev loop.
Build everything in order:
pnpm buildThis runs:
@shupeixuan/micro-panel-hubbuild (outputs:packages/micro-panel-hub/libandpackages/micro-panel-hub/dist/sub-app-demo)demo-use-micro-panel-hubbuild (outputs:packages/demo-use-micro-panel-hub/dist, includingpopout.htmlandsub-app-demo/)
In this flow, the demo build consumes the library package lib/ output rather than the source alias.
Preview the demo app production build locally:
pnpm previewIf you only want to build the publishable library package:
cd packages/micro-panel-hub
pnpm build
pnpm pack --dry-runIf you only want to run the demo app package directly:
cd packages/demo-use-micro-panel-hub
pnpm dev
# for production:
pnpm build
pnpm previewRecommended flow:
pnpm buildThen publish only the library package:
cd packages/micro-panel-hub
npm publish --access public --tag devThe published npm package includes lib/, README.md, and LICENSE, and does not publish the full workspace source tree.
That lib/ output now includes the packaged sub-app-demo/ assets and popout.html used by browser popout windows.
Inside .github/workflows:
deploy-pages.yml: installs the workspace, builds it from the root, and deployspackages/demo-use-micro-panel-hub/distnightly-build.yml: builds and packagespackages/micro-panel-hub, then publishes the nightly npm package and release artifacts
- Library package docs: packages/micro-panel-hub/README.md
- Demo package docs: packages/demo-use-micro-panel-hub/README.md
