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

@uni_toolkit/webpack-plugin-component-config

v0.1.0

Published

一个用于 UniApp 项目的 Webpack 插件,用于处理 Vue 文件中的 `<component-config>` 标签,将配置提取并合并到对应的 `小程序 JSON 文件` 中。

Downloads

1,559

Readme

@uni_toolkit/webpack-plugin-component-config

一个用于 UniApp 项目的 Webpack 插件,用于处理 Vue 文件中的 <component-config> 标签,将配置提取并合并到对应的 小程序 JSON 文件 中。

[!WARNING] Node.js >= 20.19.0

[!TIP] HBuilder X 项目 推荐使用 v0.0.14

功能特性

  • 🎯 配置提取:从 Vue 文件的 <component-config> 标签中提取 JSON 配置
  • 🔄 自动合并:将提取的配置自动合并到对应的 JSON 文件中
  • 🎨 文件过滤:支持自定义文件匹配规则
  • 🚀 小程序优化:专为小程序环境设计,只在小程序平台下生效
  • 📦 零侵入:不修改原始 Vue 文件,保持代码完整性

安装

npm install @uni_toolkit/webpack-plugin-component-config -D
# 或
pnpm add @uni_toolkit/webpack-plugin-component-config -D
# 或
yarn add @uni_toolkit/webpack-plugin-component-config -D

使用方法

配置 vue.config.js

const WebpackComponentConfigPlugin = require('@uni_toolkit/webpack-plugin-component-config').default;

module.exports = {
  configureWebpack: {
    plugins: [
      new WebpackComponentConfigPlugin()
    ]
  }
};

修改 Vue 文件

// custom-component.vue
<template>
  <view class="container">
    <text>Hello World</text>
    <test></test>
  </view>
</template>

<script>
import test from '../sub1/test' // 引入子包中的vue组件
export default {
  name: 'MyComponent',
  components: {
    test
  }
}
</script>

// #ifdef MP
<component-config>
// 此处必须是标准的 json 对象,支持条件编译
{
  "usingComponents": {
    "custom-button": "/components/custom-button"
  },
  "styleIsolation": "apply-shared",
  "componentPlaceholder": {  
    "test": "view",  
  }  
}
</component-config>
// #endif

编译到小程序端生成的 JSON 文件 如下所示

// custom-component.json
{
  "component": true,
  "usingComponents": {
    "test": "../sub1/test",
    "custom-button": "/components/custom-button"
  },
  "styleIsolation": "apply-shared",
  "componentPlaceholder": {
    "test": "view"
  }
}

配置选项

interface ComponentConfigPluginOptions {
  include?: FilterPattern;  // 包含的文件模式,默认: ["**/*.{vue,nvue,uvue}"]
  exclude?: FilterPattern;  // 排除的文件模式,默认: []
}

注意事项

  1. 平台限制:插件只在小程序环境下生效
  2. JSON 格式<component-config> 标签内的内容必须是有效的 JSON 格式

许可证

MIT