Upload your webpack-generated assets to CDN, allowing renaming/rehashing.

Overview

webpack5-cdn-plugin

For webpack4, please refer to webpack4-cdn-plugin.

Docs

Install

npm i webpack5-cdn-plugin -D

Usage

const { Webpack5CDNPlugin } = require('webpack5-cdn-plugin')

let cacheData = null;

// webpack config
module.exports = {
  plugins: [
    // ...
    new Webpack5CDNPlugin({
      keepLocalFiles: false,
      manifestFilename: 'manifest.json',
      uploadContent({ file, extname, content }) {
        const hash = md5(content)
        
        if (cacheData.has(hash)) {
          return Promise.resolve(cacheData.get(hash))
        }

        // NOTE 需要自己实现上传文件、重试、并发控制
        return uploadTaskManager
          .upload(content)
          .then(result => {
            cacheData.set(hash, result.url)
            return result.url
          })
      },
      before() {
        cacheData = readCache()
      },
      done() {
        persistCache(cacheData)
      }
    })
  ]
}
You might also like...

Generate an image of all your Github contributions

Generate an image of all your Github contributions

GitHub Contribution Chart Generator Generates an image of all your GitHub contributions since you have signed up, so you can use it in social media. T

Jan 2, 2023

Visualize your tech stack and database with a simple, beautiful, and interactive web app.

Stacify Visualize your tech stack and database with a simple, beautiful, and interactive web app. Why Stacify Why would you want to use Stacify? Well,

Jan 20, 2022

A simple tool to help you connect your favorite controllers / Arduino to various train simulator games on Windows using memory hacks.

A simple tool to help you connect your favorite controllers (e.g. Densha de Go! series) / Arduino to various train simulator games on Windows using memory hacks.

Feb 7, 2022

A web application to 🔍inspect your GitHub Profile Stats📊 in a lucid way. Visualization made easy with Charts💡🚀

A web application to 🔍inspect your GitHub Profile Stats📊 in a lucid way. Visualization made easy with Charts💡🚀

know-your-gitstats A web application to 🔍 inspect your GitHub Profile Stats 📊 in a lucid way. Visualization made easy with Charts 💡 🚀 . ✅ Features

Oct 15, 2022

GreetHub - Dynamic greeting for your readme profile 😍😍

GreetHub - Dynamic greeting for your readme profile 😍😍

GreetHub - Dynamic greeting for your readme profile 😍😍

Oct 27, 2022

Evolve is an online investment portfolio management system where users can keep track of all the assets that they have invested in and how well their assets are performing.

Evolve is an online investment portfolio management system where users can keep track of all the assets that they have invested in and how well their assets are performing.

Evolve is an online investment portfolio management system where users can keep track of all the assets that they have invested in and how well their assets are performing.

Oct 16, 2022

Contains html file showcasing Earthquake related data generated in the form of VR model, ArcGIS API with real-time earthquake feed and video of simulation of earthquake generated in blender

Contains html file showcasing Earthquake related data generated in the form of VR model, ArcGIS API with real-time earthquake feed and video of simulation of earthquake generated in blender

Module-EADGI-Project-All about Earthquakes Introduction Contains html file showcasing Earthquake related data generated in the form of VR model, ArcGI

Jun 9, 2022

Programmatically upload NFT assets to OpenSea.io for free

Programmatically upload NFT assets to OpenSea.io for free

OpenSea Uploader This is the example repository for my blog post How to Mint 100,000 NFTs For Free. Please note that this is merely a proof of concept

Sep 15, 2022

Find all libraries on cdn.js that pollute your prototype

Who pollutes your prototype? (I wrote a blog post for this, English, 中文) One day, I was searching for a way to bypass Angular sandbox, and I found thi

Sep 27, 2022

Upload or Upload & Publish your bundle (apk or aab) to Huawei AppGallery with ConnectApi

appgallery-publisher Upload/Publish your bundle (apk or aab) to AppGallery automatically with appgallery-publisher Usage Single Javascript File Bash F

Sep 19, 2022

A website of pkupiano, allowing members upload their own recordings

A website of pkupiano, allowing members upload their own recordings

SoundLib: A Music Recording Library SoundLib (abbreviation of sound library), provides a site for users to upload their own music recordings. Todo Lis

Jun 16, 2022

A blazingly fast CDN, at par and up-to-date with modern web technologies

A blazingly fast CDN, at par and up-to-date with modern web technologies

Sep 22, 2022

Best dialogue for file creation, renaming, opening, deletion or jumping to a specific line

Best dialogue for file creation, renaming, opening, deletion or jumping to a specific line

Features No need to rely on vscode.quickOpen Create, rename, delete, open files/folders without relying on the sidebar Jump to specific lines Find spe

Jul 31, 2022

🚀 Blazing Fast S3 Powered CDN ✨ Powered By Fastify, S3 Buckets & Docker!

🚀 WasiCDN Blazing Fast S3 Powered CDN, Powered By Fastify, S3 Compatible Buckets & Docker! Core DockerHub: https://hub.docker.com/r/maximking19/wasic

Aug 31, 2022

Rename image after pasting, support name pattern and auto renaming.

Rename image after pasting, support name pattern and auto renaming.

Obsidian paste image rename This plugin is inspired by Zettlr, Zettlr shows a prompt that allows the user to rename the image, this is a great help if

Jan 2, 2023

jQuery-plugin for add/remove dom-items with renaming form-elements (arrays)

dynamicrows jQuery-plugin for add/remove rows by cloning existing row / renaming form-elements (arrays). Requirements jQuery =2.0 if move-action used

Nov 9, 2020

This is an upload script which allows you to upload to web3 storage using JS.

This is an upload script which allows you to upload to web3 storage using JS. first make sure to run npm install on the directory run script using nod

Dec 24, 2021

Express js webserver integration with edgejs templating engine using webpack assets manager and hot reloading

Express js webserver integration with edgejs templating engine using webpack assets manager and hot reloading

Feb 12, 2022

In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaScript index file that imported all the modules and assets

In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaScript index file that imported all the modules and assets

To Do List In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaSc

Mar 31, 2022
Owner
文蔺
Web Developer
文蔺
This JavaScript library produces complementary gradients generated from the top 2 dominant colours in supplied images.

Grade Demo Check it out Install Download this repo and grab the grade.js file from the /docs/dist folder. Or install from npm: npm install grade-js Us

Ben Howdle 3.7k Jan 2, 2023
procedurally generated fish drawings

fishdraw procedurally generated fish drawings. demo generates all sorts of weird fishes outputs polylines (supported format svg, json, csv, etc.) full

Lingdong Huang 2.1k Jan 3, 2023
Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.

Redash is designed to enable anyone, regardless of the level of technical sophistication, to harness the power of data big and small. SQL users levera

Redash 22.4k Dec 30, 2022
Matteo Bruni 4.7k Jan 4, 2023
🌀 The Javacript framework for creating a portal to your data. Perfect for a single dataset or a full catalog.

?? Portal.JS The javascript framework for data portals ?? portal is a framework for rapidly building rich data portal frontends using a modern fronten

Datopian 2k Dec 30, 2022
SandDance - Visually explore, understand, and present your data.

Visually explore, understand, and present your data.

Microsoft 5.9k Jan 3, 2023
A web app that shows visualizations of the most used graphs algorithms such as BFS, DFS, Dijsktra, Minimum spanning tree, etc. It allows you to draw your own graph.

Graph Visualizer Draw your own graphs and visualize the most common graph algorithms This web application allows you to draw a graph from zero, with p

Gonzalo Pereira 31 Jul 29, 2022
Plug is a browser extension for users of the Internet Computer that allows you to access your ICP, Cycles, and other tokens as well as log into IC apps with one click.

Plug Introduction Welcome to Plug! An Internet Computer crypto wallet and authentication provider as a browser extension. Find our latest version in t

Psychedelic 150 Dec 23, 2022
The code base that powered India in Pixels' YouTube channel for more than 2 years - now open sourced for you to use on your own projects

India in Pixels Bar Chart Racing For over two years, this nifty code base powered India in Pixels' YouTube channel with videos fetching over millions

India in Pixels 141 Dec 4, 2022
This plugin for Chart.js that makes your bar chart to 100% stacked bar chart.

chartjs-plugin-stacked100 This plugin for Chart.js that makes your bar chart to 100% stacked bar chart. Requires Chart.js 3.x. Demo: https://y-takey.g

y-take 106 Jan 3, 2023