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

create-webp-webpack-plugin

v1.0.1

Published

将项目图片生成对应的webp格式

Readme

create-webp-webpack-plugin

简体中文文档 将项目图片生成对应的 webp 格式

安装

npm i -D create-webp-webpack-plugin
// or
yarn add -D create-webp-webpack-plugin

选项

match

Type: regexp Default: /\.(png|gif|svg)$/

匹配需要生成 webp 的图片

webp

Type: object Default: { lossless: true }

该选项同 sharp webp options

各种格式使用转化成 webp 说明

| 序号 | 压缩模式 | webp 设置 | jpg | jpeg | png | gif | svg | jpg2 | png2 | gif2 | 图片质量 | | ----- | -------- | --------- | ------- | ---- | -------- | ---- | ---- | -------- | -------- | ---- | ------------------------------------- | | 1 | 未处理 | 未处理 | 13.3 | 4.78 | 74.3 | 204 | 1.97 | 188 | 60.1 | 169 | ---- | | 2 | 压缩 | 未处理 | 12.3 | 5.94 | 52.2 | 204 | 1.26 | 96.2 | 18.5 | 168 | 优秀(效果等同原图) | | 3 | 压缩 | 无损 | 61.2 | 31.5 | 45.3 | 78.4 | 2.29 | 469 | 15.7 | 4.73 | 优秀(效果等同原图) | | 4 | 压缩 | 80 | 8.38 | 5.39 | 6.68 | 18.3 | 2.76 | 54.2 | 13.8 | 3.00 | 一般(体积等同压缩 webp80,但质量要差) | | 5 | 无压缩 | 无损 | 61.4 | 31.2 | 41.5 | 78.4 | 2.29 | 430 | 37.8 | 4.73 | 优秀(效果等同原图) | | 6 | 无压缩 | 90 | 14.1 | 8.01 | 11.6 | 39.2 | 2.94 | 84.8 | 18.0 | 4.14 | 优秀 | | 7 | 无压缩 | 85 | 13.3 | 6.40 | 8.50 | 26.3 | 2.83 | 69.2 | 16.0 | 3.47 | 良好(推荐) | | 8 | 无压缩 | 80 | 8.38 | 5.36 | 6.55 | 18.3 | 2.76 | 57.8 | 14.6 | 3.00 | 一般 | | 9 | 无压缩 | 75 | 6.77 | 4.62 | 5.18 | 13.7 | 2.70 | 49.5 | 13.3 | 2.59 | 较差 |

分析

  • 对于压缩过的 jpg,jpeg 再使用 webp 无损转化会增大 2 倍以上体积,参考序号 3,5
  • 压缩后再转成 webp,jpg 不适合转成 webp,png 可再减小 15% 左右的体积

总结

  • 在不使用 webp 时,推荐使用 image-webpack-loader 压缩,参考序号 2
  • 在使用 webp 时,推荐使用不压缩,以 90 的质量转成 webp,质量和序号 2 的效果一致,体积相比于直接压缩更小

License

MIT