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 🙏

© 2024 – Pkg Stats / Ryan Hefner

del-useless-plugin

v1.0.0

Published

删除无用文件的webpack插件

Downloads

2

Readme

del-useless-plugin

该webpack插件用于查找和删除项目里无用的文件。

安装

npm install --save-dev del-useless-plugin

用法

1、引入和配置插件

const DelUselessPlugin = require('del-useless-plugin')

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

2、获取无用文件

运行项目打包命令(如:npm run pro),在项目中就会出现一个useless-list.json文件,文件内容是项目中无用文件构成的数组。

[
    "E:\\eqx\\mall-pay\\src\\img\\[email protected]",
    "E:\\eqx\\mall-pay\\src\\scss\\variables.scss",
    "E:\\eqx\\mall-pay\\src\\utils\\index.js",
    "E:\\eqx\\mall-pay\\src\\vue\\plugins\\Slide.vue"
]

3、确认输出,删除文件

  1. 使用者可对useless-list.json文件进行修改,如认为文件不是无用文件,可从数组中去除。

  2. 控制台运行如下命令,即可删除useless-list.json数组中的所有文件。

    node ./node_modules/del-useless-plugin/src/del.js

Options

| 名称 | 类型 | 默认值 | 描述 | | --------- | --------- | ------ | ---------------------------- | | root | {String} | ./src | 需要查找的代码根目录 | | clean | {Boolean} | false | 是否在查找完成就直接删除文件 | | exclude | {Array} | [] | 需要排除的目录数组 | | backupDir | {String} | ‘’ | 备份目录,提供备份功能 |

其他

已知问题

  1. 此插件无法查找出其他插件的依赖,如

    // sass-loader 直接引用了variables.scss文件且variables.scss没有在其他文件中进行引用,此插件就会把variables.scss识别为无用文件
    module.exports = {
      module: {
        rules: [
          {
            test: /\.scss$/,
            use: [
               {
                 loader: 'sass-loader',
                 options: {
                     data: fs.readFileSync('./src/scss/variables.scss')
                 }
             }
            ],
          },
        ],
      },
    };