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

custom-webpack-plugin

v1.0.1

Published

优化打包策略,剔除无用文件。帮助缩小打包体积,减少打包产物。

Downloads

3

Readme

CustomWebpackPlugin 使用说明

CustomWebpackPlugin 是一个自定义的 Webpack 插件,提供了两个插件:SplitChunksPlugin 和 ExcludeFilePlugin。本文档将详细介绍这两个插件的使用方法和参数配置。

安装

使用 npm 安装 CustomWebpackPlugin:

npm install custom-webpack-plugin

使用示例

以下是一个完整的示例,展示了如何同时使用 SplitChunksPlugin 和 ExcludeFilePlugin:

const { SplitChunksPlugin, ExcludeFilePlugin } = require('custom-webpack-plugin')

module.exports = {
  // 其他配置项...
  chainWebpack: (config) => {
    config.plugin('splitChunksPlugin').use(new SplitChunksPlugin())
    config.plugin('excludeFilePlugin').use(new ExcludeFilePlugin())
  }
}

SplitChunksPlugin

SplitChunksPlugin 是一个用于优化代码分割的插件。它可以将代码分割为多个块,提高代码的加载效率。

  • options (可选): 配置选项对象,用于定制代码分割的行为。

配置选项

SplitChunksPlugin 的配置选项包括:

  • chunks (默认值: 'all'): 指定哪些代码块需要进行分割。可选值有 'all', 'async', 'initial'。
  • maxAsyncRequests (默认值: 5): 异步加载的最大并行请求数。
  • maxInitialRequests (默认值: 3): 初始加载的最大并行请求数。
  • cacheGroups (默认值: {}): 定义缓存组,用于控制代码块的分组行为。

ExcludeFilePlugin

ExcludeFilePlugin 是一个用于排除指定文件的插件。它可以在构建过程中排除特定的文件,例如排除 markdown 和 txt 文件。

  • options (可选): 配置选项对象,用于指定要排除的文件类型。

配置选项

ExcludeFilePlugin 的配置选项包括:

  • exclude (默认值: [/.md$/, /.txt$/]): 排除的文件类型的正则表达式数组。