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

taro-plugin-inject-component

v1.0.1

Published

自动注入自定义组件的taro插件

Readme

介绍

当你的项目在小程序端存在全局组件,并且会打包到主包的时候你可能需要用到这个 Taro 插件

针对TARO项目实现全局自定义组件引用,将全局组件打包到分包之中,然后利用小程序的分包异步化特性跨分包自定义组件引用,就能让该组件脱离主包

本插件会自动在生成的产物的 wxml 和 index.json 中注入组件和组件声明。(目前兼容微信小程序和抖音小程序)

参数

  {
    ignore: [], // 需要忽略的文件夹,基于 Glob 语法
    component: string, // 组件名称,例如: <login-dialog> />
    usingComponentPath: string, // 公共组件的分包路径,例如:./common-component/login-dialog/index
    showLog: boolean, // 是否显示日志,默认为 false
    componentConfig: [ // 1.0.1 开始支持多个组件注入
      {
        component: "<global-notification />",
        usingComponentPath: "common-components/GlobalNotification/index"
      },
      {
        component: "<login-dialog />",
        usingComponentPath: "common-components/LoginDialog/index"
      }
    ],
  }

使用方法

  1. 安装依赖包
yarn install taro-plugin-inject-component
  1. 配置 taro插件 config/index.js 文件
{
  // ...other config
  plugins: [
    [
      'taro-plugin-inject-component',
      {
        ignore: [
          "**/common-components/**",
          "**/mp-html/**",
          '**/setting/home/**',
          '**/login/**'
        ],
        component: "<login-dialog />",
        usingComponentPath: "common-components/LoginDialog/index",
        showLog: true,
        componentConfig: [
          {
            component: "<global-notification />",
            usingComponentPath: "common-components/GlobalNotification/index"
          },
          {
            component: "<login-dialog />",
            usingComponentPath: "common-components/LoginDialog/index"
          }
        ],
      }
    ]
  ]
}