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

veimagex-webpack-plugin

v0.0.1

Published

一款 webpack 插件,可以将代码中引入的本地图片资源上传至云端(veImageX),快速接入 veImageX 提供的云端处理能力,并且能够根据浏览器的支持情况加载高压缩率格式的图片,以优化图片加载速度,使用前请先开通[`veImageX图片服务`](https://t.zijieimg.com/dnbVv2k/)

Downloads

1

Readme

veImageX Webpack Plugin

一款 webpack 插件,可以将代码中引入的本地图片资源上传至云端(veImageX),快速接入 veImageX 提供的云端处理能力,并且能够根据浏览器的支持情况加载高压缩率格式的图片,以优化图片加载速度,使用前请先开通veImageX图片服务

安装

// use npm
npm install veimagex-webpack-plugin --save-dev

// use yarn
yarn add veimagex-webpack-plugin --dev

配置

插件分为两部分:

  • loader部分将本地图片上传至 veImageX,并替换成 veImageX 生成的url
  • plugin部分用于处理 css 中引入的本地图片

loader部分的使用方法同 file-loader,支持 file-loader 的所有参数,新增了用于图片上传和处理的参数,file-loader相关参数主要用于上传失败后的文件处理

// webpack.config.js

const ImagexWebpackPlugin = require('veimagex-webpack-plugin');

// 引入loader
module: {
  rules: [
    {
      loader: ImagexWebpackPlugin.loader,
      test: /\.(png|jpe?g)$/i,
      options: {
        outputPath: 'static/media',
        name: '[name].[hash:8].[ext]',
        serviceId: '<veImageX服务ID>',
        template: '<veImageX模板名称>',
        domain: '<veImageX上绑定的域名>',
        params: '<参数数组>', // 如果模板中有url参数则需要指定
        accessKey: '<火山引擎accessKey>',
        secretKey: '<火山引擎secretKey>',
        region: 'cn' | 'sg' | 'us', // 上传区域
      },
    }
  ]
},

// 引入plugin
plugins: [
  new ImagexWebpackPlugin(HtmlWebpackPlugin, {
    format: 'webp' | 'heif' | 'avif', // 目标图片格式
  })
]

注意

不要对同一个图片文件同时使用 file-loader 和 veimagex-webpack-plugin