一覧へ戻る
Linyan-ma/rollup-plugin-cdn-upload(新しいタブで開きます)
主要言語: JavaScript
- star 数
- 6
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2022/04/13
主要言語: 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