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

github-jsdelivr-upload

v1.0.8

Published

upload your files to github and replace your src with jsdelivr

Readme

github-jsdelivr-upload

简介

这是一个使用免费cdnwebpack插件

它的原理是将文件上传到github的public仓库中,然后通过不同的服务生成对应的cdn链接,并且在合适的webpack生命周期中通过html-webpack-plugin提供的hook,修改页面中link、script标签,更换为cdn提供的链接。目前支持jsdelivrstaticaly两种cdn,默认为jsdelivr

此外,它还会往页面中插入cdn异常处理代码,原理是通过onerror事件,重新改写你的文件路径,将使用index.html相对路径下的源文件(即部署时,建议不要删除源文件)。

注:使用的html-webpack-plugin为4.x以上。如果版本低于4,则可能需要升级html-webpack-plugin到对应的版本。

  • webpack4对应html-webpack-plugin4.x
  • webpack5对应html-webpack-plugin5.x

ps:建议不要使用自己常用的github账号作为cdn的存储仓库,该插件会使用的github中提供给的token,拥有该tonken的用户则可以通过相关的api修改你的github中的内容。

用法

const UploadGithub = require('github-jsdelivr-upload');


// webpack.config.js
module.exports = {
    plugins:[
        new UploadGithub({
            token: 'your github token',
            owner: 'your github username',
            repo: 'your github repository',
            cdnType: 'jsDelivr' // staticaly、jsDelivr, 默认为:jsDelivr
        }),
    ]
}


// vue.config.js
module.exports = {
    configureWebpack:{
        plugins:[
            new UploadGithub({
                token: 'your github token',
                owner: 'your github username',
                repo: 'your github repository',
            }),
        ]
    }
}

// craco.config.js
module.exports = {
    webpack:{
        plugins:[
            new UploadGithub({
                token: 'your github token',
                owner: 'your github username',
                repo: 'your github repository',
            }),
        ]
    }
}