Gathering detailed insights and metrics for webpack4-cdn-plugin
Gathering detailed insights and metrics for webpack4-cdn-plugin
Gathering detailed insights and metrics for webpack4-cdn-plugin
Gathering detailed insights and metrics for webpack4-cdn-plugin
webpack-cdn-local-plugin
一个webpack插件,将外部cdn下载到本地并注入页面。
css-dynamic-import-plugin
Used for Webpack4 only. Replace prefix of any urls in css file with a new path. Configured for Cdn urls in most cases.
import-retry-plugin
dynamic import script with webpack4 ,when loading chunk error,retry it and break cdn ticks
Upload webpack assets to cdn, allowing to rename/hash assets.
npm install webpack4-cdn-plugin
Typescript
Module System
Node Version
NPM Version
59.5
Supply Chain
64
Quality
74.6
Maintenance
100
Vulnerability
100
License
TypeScript (99.72%)
JavaScript (0.28%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
11 Stars
174 Commits
6 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Apr 18, 2022
Latest Version
1.6.0
Package Id
webpack4-cdn-plugin@1.6.0
Unpacked Size
42.99 kB
Size
11.56 kB
File Count
13
NPM Version
6.9.0
Node Version
12.6.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
For webpack5, please refer to webpack5-cdn-plugin
Upload your webpack-generated assets to CDN, allowing renaming/rehashing.
Node 8+ (which supports async/await
) is required recommanded.
This plugin has NOT been tested on Windows platform.
This plugin supports webpack@4 ONLY.
process.env.NODE_ENV
OR options.mode
: this plugin only works in production mode.
output.publicPath
: we only support /
or empty string (for simplicity).
optimization.minimize
: false
is preferred if your CDN provider can do compressing work.
npm install -D webpack4-cdn-plugin
# or
yarn add --dev webpack4-cdn-plugin
1const WebpackCDNPlugin = require('webpack4-cdn-plugin') 2 3module.exports = { 4 // ... other fields 5 plugins: [ 6 // ...other plugins 7 ] 8} 9 10if (process.env.NODE_ENV === 'production') { 11 const cdnPlugin = new WebpackCDNPlugin({ 12 // whether to keep generated files (on local fs), default: `false` 13 keepLocalFiles: false, 14 // whether to keep generated sourcemaps, default: `false` 15 keepSourcemaps: false, 16 // whether to backup html files (before replaced), default: `false` 17 backupHTMLFiles: true, 18 // manifest file name (`String | false`) 19 manifestFilename: 'manifest.json', 20 21 // a function, which returns `Promise<url>` 22 // you can do your compressing works with content 23 // `params.content`: `String | Buffer` 24 // `params.extname`: file extension 25 // `params.file`: original file (with path) 26 uploadContent({ content, extname, file }) { 27 /** 28 * Return falsy value means that you want to KEPP the 29 * file as it is. This usually happens with certain 30 * file types, which may not be supported by your CDN 31 * provider, or must be under the same origin with your 32 * HTML files(for example, files like `.wasm` that 33 * should be loaded by `fetch` or `XMLHttpRequest`). 34 * 35 * !!! Note !!! 36 * Be CAREFUL with media resources (especially images). 37 * When you are using an image in your CSS file, while 38 * deciding not to upload that it(the image), it CAN lead 39 * to an unexpected `404 (Not Found)` ERROR. 40 */ 41 if (['ico', 'txt', 'wasm'].includes(extname)) { 42 return false 43 } 44 45 // You can also implement your own cache here 46 const hash = md5(content) 47 if (youCache.has(hash)) { 48 return youCache.get(hash) 49 } 50 51 return require('your-cdn-provider').uploadContent({ 52 content: content, 53 fileType: getFileType(extname) 54 }) 55 // for testing 56 // const hash = (Math.random() ).toString(16).split('.')[1] 57 // return Promise.resolve(`https://cdn.example.com/${hash}.${extname}`) 58 } 59 }) 60 61 module.exports.plugins.push(cdnPlugin) 62}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/22 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
136 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More