Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

component-usage-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

component-usage-webpack-plugin

statistic component usage

  • 1.0.5
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

component-usage-webpack-plugin

statistic component usage

目前仅支持.vue和.js文件统计

支持vue2和vue3

npm install

npm install component-usage-webpack-plugin --save-dev

Usage

默认统计element-ui组件使用情况

const ComponentUsageWebpackPlugin = require('component-usage-webpack-plugin');

module.exports = {
  plugins: [
    new ComponentUsageWebpackPlugin()
  ]
}

统计其他UI组件,统计ant-design组件

const ComponentUsageWebpackPlugin = require('component-usage-webpack-plugin');

module.exports = {
  plugins: [
    new ComponentUsageWebpackPlugin({
      regex: /<(ant-[a-z\-]+)/g, // Ant Design
    })
  ]
}

可同时统计多个UI组件

const ComponentUsageWebpackPlugin = require('component-usage-webpack-plugin');

module.exports = {
  plugins: [
    new ComponentUsageWebpackPlugin({
      regex: /<(ant-[a-z\-]+)/g, // Ant Design
    }),
    new ComponentUsageWebpackPlugin({
      regex: /<(van-[a-z\-]+)/g, // Vant UI
    })
  ]
}

参数

参数说明类型默认值
regex正则表达式,用于匹配需要统计的组件RegExp/<(el-[a-z-]+)/g
fileTypes要统计的文件类型String(vue/all)vue

注意

1. 组件使用统计只在开发环境下生效,且统计启动时项目不会正常启动

Keywords

FAQs

Package last updated on 30 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc