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

asset-webpack-plugin

v0.2.4

Published

一个处理静态资源的webpack插件

Readme

asset-webpack-plugin

:kissing_heart:一个处理静态资源的 webpack 插件。

特性:默认处理 .png | .jpe | .jpep | .gif | .svg | .woff | .woff2 | .eot | .ttf | .otf | .mp4 | .webm | .ogg | .mp3 | .wav | .flac | .aac 文件,分别生成对应 image | font | media 文件夹的资源文件

:point_right: github npm-version webpack nodejs license pull request

安装获取

yarn add asset-webpack-plugin -D

npm install asset-webpack-plugin -D

pnpm install asset-webpack-plugin -D

使用方式

const AssetWebpackPlugin = require('asset-webpack-plugin')

module.exports = {
  plugins: [new AssetWebpackPlugin()]
}
const AssetWebpackPlugin = require('asset-webpack-plugin')

module.exports = {
  plugins: [
    new AssetWebpackPlugin({
      image: {
        limit: 1024,
        //...
      },
      font: {
        esModule: false
        //...
      },
      media: {
        esModule: false
        //...
      },
      //...
    })
  ]
}

配置项

具体配置项的数据类型见types.ts

image 默认

  • name 输出资源名称。 默认: 'image/[name].[hash:8].[ext]'
  • regExp 使用正则表达式来过滤需要处理的文件。 默认: /\.(png|jpe?g|gif|svg)(\?.*)?$/
  • limit 该限制可以通过加载程序选项指定。 默认: 500
  • fallback 指定当目标文件的大小超过 limit 选项中设置的限制时使用的备用 loader。 默认: 'file-loader'
  • ... file-loader的 options 配置。

font 默认

  • name 输出资源名称。 默认: 'fonts/[name].[hash:8].[ext]'
  • regExp 使用正则表达式来过滤需要处理的文件。 默认: /\.(woff2?|eot|ttf|otf)(\?.*)?$/
  • limit 该限制可以通过加载程序选项指定。 默认: 1e4
  • fallback 指定当目标文件的大小超过 limit 选项中设置的限制时使用的备用 loader。 默认: 'file-loader'
  • ... file-loader的 options 配置。

media 默认

  • name 输出资源名称。 默认: 'media/[name].[hash:8].[ext]'
  • regExp 使用正则表达式来过滤需要处理的文件。 默认: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/
  • limit 该限制可以通过加载程序选项指定。 默认: 1e4
  • fallback 指定当目标文件的大小超过 limit 选项中设置的限制时使用的备用 loader。 默认: 'file-loader'
  • ... file-loader的 options 配置。

[name] 自定义名称,例如:pdf

  • name 输出资源名称。 默认: 'pdf/[name].[hash:8].[ext]'
  • regExp 使用正则表达式来过滤需要处理的文件。
  • limit 该限制可以通过加载程序选项指定。
  • fallback 指定当目标文件的大小超过 limit 选项中设置的限制时使用的备用 loader。 默认: 'file-loader'
  • ... file-loader的 options 配置。