npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@farmfe/js-plugin-qiankun

v1.0.0-beta.0

Published

farm qiankun plugin

Readme

Qiankun Js Plugin for Farm

支持在 Farm 构建工具中使用 qiankun 微前端框架。

使用方法

farm.config.ts 中配置插件:

import { defineConfig } from '@farmfe/core';
import { qiankunFarmPlugin } from '@farmfe/js-plugin-qiankun';

export default defineConfig({
  ...,
  plugins: [
    qiankunFarmPlugin({
      appName: 'my-micro-app', // 微应用名称,必填
      devMode: true // 是否开启开发模式,可选,默认为 false
    })
  ]
});

完整示例

React 应用示例

// main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { injectQiankun } from '@farmfe/js-plugin-qiankun/helper';
import App from './App';

let root: ReactDOM.Root | null = null;

injectQiankun({
  async bootstrap() {
    console.log('React 微应用启动');
  },
  
  async mount(props) {
    console.log('React 微应用挂载', props);
    const container = document.getElementById('root');
    if (container) {
      root = ReactDOM.createRoot(container);
      root.render(<App />);
    }
  },
  
  async unmount() {
    console.log('React 微应用卸载');
    if (root) {
      root.unmount();
      root = null;
    }
  }
});

Vue 应用示例

// main.ts
import { createApp } from 'vue';
import { injectQiankun } from '@farmfe/js-plugin-qiankun/helper';
import App from './App.vue';

let app: ReturnType<typeof createApp> | null = null;

injectQiankun({
  async bootstrap() {
    console.log('Vue 微应用启动');
  },
  
  async mount(props) {
    console.log('Vue 微应用挂载', props);
    app = createApp(App);
    app.mount('#app');
  },
  
  async unmount() {
    console.log('Vue 微应用卸载');
    if (app) {
      app.unmount();
      app = null;
    }
  }
});

选项说明

PluginOptions

appName

  • 类型: string
  • 必填: 是
  • 说明: 微应用的名称,用于在全局对象上注册生命周期函数

devMode

  • 类型: boolean
  • 默认值: false
  • 说明: 是否开启开发模式。开启后会在控制台输出调试信息

InjectOptions

bootstrap

  • 类型: () => Promise<void>
  • 必填: 是
  • 说明: 应用启动时的生命周期钩子

mount

  • 类型: (props: unknown) => Promise<void>
  • 必填: 是
  • 说明: 应用挂载时的生命周期钩子,props 为主应用传递的属性

unmount

  • 类型: () => Promise<void>
  • 必填: 是
  • 说明: 应用卸载时的生命周期钩子

update

  • 类型: (props: unknown) => Promise<void>
  • 必填: 否
  • 说明: 应用更新时的生命周期钩子,props 为主应用传递的属性

参考项目