Back to results
Linyan-ma/rollup-plugin-cdn-upload(opens in a new tab)
Language: JavaScript
- stars
- 6
- watchers
- 1
- forks
- 0
- open issues
- 0
- Last updated
- 04/13/2022
Language: JavaScript
A Rollup plugin which parsing local assets,upload it to cdn and replace the source[html | chunks],also support Vite
npm install rollup-plugin-cdn-upload --save-dev
import cdnUpload from "rollup-plugin-cdn-upload"; export default { input: "src/index.js", output: { dir: "output", format: "cjs", }, plugins: [ cdnUpload({ uploader: (content, ext) => { return Promise.resolve(""); }, }), ], };
for vite,base must set '' (default is /)
export default defineConfig({ base: "", build: { rollupOptions: { plugins: [ cdnUpload({ uploader: (content, ext) => { return Promise.resolve(""); }, }), ], }, }, });
function(content,ext):<Promise>(content: sourceCode, ext: type) => { return Promise.resolve(""); };
booleanfalsekeep uploaded modules or not
string./dist_cdnthe response url will cached in this directory
string./dist_cdnoutput directory