Ecosystem โ
qiankun provides a rich ecosystem of UI bindings and tools to help you build and maintain micro-frontend applications efficiently.
๐งฉ UI Bindings โ
qiankun offers declarative UI components for popular frameworks, making it easier to load and manage micro applications within your main application.
React โ
@qiankunjs/react - Official React bindings for qiankun
- Features: Declarative MicroApp component, automatic loading states, error boundaries
- Benefits: Type-safe, React hooks support, seamless integration
- Use Case: Perfect for React-based main applications
npm install @qiankunjs/reactLearn more about React bindings โ
Vue โ
@qiankunjs/vue - Official Vue bindings for qiankun
- Features: Vue 2/3 compatible, composition API support, slot-based customization
- Benefits: Reactive loading states, template-based approach, TypeScript support
- Use Case: Ideal for Vue-based main applications
npm install @qiankunjs/vueLearn more about Vue bindings โ
๐ ๏ธ Development Tools โ
Webpack Plugin โ
@qiankunjs/webpack-plugin - Webpack plugin for micro applications
- Features: Automatic public path injection, build optimization, development mode support
- Benefits: Zero-config setup, improved developer experience, production-ready builds
- Use Case: Essential for webpack-based micro applications
npm install @qiankunjs/webpack-plugin --save-devLearn more about Webpack Plugin โ
Create Qiankun โ
create-qiankun - CLI tool for scaffolding qiankun projects
- Features: Multiple templates, main app + micro app setup, best practices included
- Benefits: Quick project initialization, production-ready configurations, modern tooling
- Use Case: Starting new qiankun projects or adding micro-frontend capabilities
npx create-qiankun my-micro-frontend-appLearn more about Create Qiankun โ
๐ฏ Quick Start Comparison โ
Without UI Bindings (Core API) โ
import { loadMicroApp } from 'qiankun';
// Manual approach
const microApp = loadMicroApp({
name: 'my-app',
entry: '//localhost:8080',
container: '#subapp-container'
});
// Manual lifecycle management
microApp.mountPromise.then(() => {
setLoading(false);
}).catch(error => {
setError(error);
});With React Binding โ
import { MicroApp } from '@qiankunjs/react';
function App() {
return (
<MicroApp
name="my-app"
entry="//localhost:8080"
autoSetLoading
autoCaptureError
/>
);
}With Vue Binding โ
<template>
<MicroApp
name="my-app"
entry="//localhost:8080"
autoSetLoading
autoCaptureError
/>
</template>
<script setup>
import { MicroApp } from '@qiankunjs/vue';
</script>๐ Integration Flow โ
graph LR
A[Main App] --> B[UI Binding]
B --> C[qiankun Core]
C --> D[Micro App 1]
C --> E[Micro App 2]
C --> F[Micro App 3]
G[Webpack Plugin] --> D
G --> E
G --> F
H[Create Qiankun] --> A
H --> D
H --> E
H --> F๐ Feature Comparison โ
| Feature | Core API | React Binding | Vue Binding |
|---|---|---|---|
| Loading States | Manual | โ Automatic | โ Automatic |
| Error Handling | Manual | โ Error Boundary | โ Error Boundary |
| Custom Loading | Manual | โ Component | โ Slot |
| Custom Errors | Manual | โ Component | โ Slot |
| TypeScript | โ Full | โ Full | โ Full |
| Framework Integration | Manual | โ Hooks | โ Composition API |
๐จ Usage Patterns โ
1. Simple Loading โ
React:
<MicroApp
name="dashboard"
entry="//localhost:8080"
autoSetLoading
/>Vue:
<MicroApp
name="dashboard"
entry="//localhost:8080"
auto-set-loading
/>2. Custom Loading & Error Handling โ
React:
<MicroApp
name="dashboard"
entry="//localhost:8080"
loader={(loading) => loading ? <Spinner /> : null}
errorBoundary={(error) => <ErrorAlert error={error} />}
/>Vue:
<MicroApp name="dashboard" entry="//localhost:8080">
<template #loader="{ loading }">
<Spinner v-if="loading" />
</template>
<template #error-boundary="{ error }">
<ErrorAlert :error="error" />
</template>
</MicroApp>3. Props Passing โ
React:
<MicroApp
name="user-profile"
entry="//localhost:8080"
userId={currentUser.id}
theme={theme}
/>Vue:
<MicroApp
name="user-profile"
entry="//localhost:8080"
:app-props="{ userId: currentUser.id, theme }"
/>๐ Getting Started โ
Step 1: Choose Your Stack โ
- React Main App โ Use
@qiankunjs/react - Vue Main App โ Use
@qiankunjs/vue - Other Framework โ Use core qiankun APIs
Step 2: Scaffold Your Project โ
# Create new project
npx create-qiankun my-app
# Choose template:
# - React main + React micro apps
# - Vue main + Vue micro apps
# - Umi main + multiple micro apps
# - Custom configurationStep 3: Configure Micro Apps โ
Add webpack plugin to each micro application:
// webpack.config.js
const { QiankunWebpackPlugin } = require('@qiankunjs/webpack-plugin');
module.exports = {
plugins: [
new QiankunWebpackPlugin()
]
};Step 4: Start Development โ
# Start main app
cd main-app && npm start
# Start micro app (in separate terminal)
cd micro-app && npm start๐ง Advanced Configuration โ
Environment-based Configuration โ
// React main app
const MicroAppConfig = {
development: {
entry: '//localhost:8080',
autoSetLoading: true,
autoCaptureError: true,
},
production: {
entry: '//your-domain.com/micro-app',
autoSetLoading: false, // Custom loading
autoCaptureError: true,
}
};
const config = MicroAppConfig[process.env.NODE_ENV];
function App() {
return <MicroApp name="my-app" {...config} />;
}Multi-app Dashboard โ
// React - Multiple micro apps
function Dashboard() {
return (
<div className="dashboard">
<aside>
<MicroApp name="navigation" entry="//localhost:8001" />
</aside>
<main>
<MicroApp name="content" entry="//localhost:8002" />
</main>
<footer>
<MicroApp name="footer" entry="//localhost:8003" />
</footer>
</div>
);
}๐ Documentation Links โ
- React Bindings - Complete React integration guide
- Vue Bindings - Complete Vue integration guide
- Webpack Plugin - Build tool configuration
- Create Qiankun - Project scaffolding
- API Reference - Core qiankun APIs
๐ค Community โ
- GitHub Discussions - Ask questions and share ideas
- Issues - Bug reports and feature requests
- Changelog - Latest updates and releases
Choose the tools that best fit your project needs and start building powerful micro-frontend applications!
