webpack-cdn2local-plugin
Advanced tools
+6
-3
| var cheerio = require('cheerio'); | ||
| let url = require('url'); | ||
| let https = require('https'); | ||
| let http = require('http'); | ||
@@ -27,4 +28,5 @@ var uglifycss = require('uglifycss'); | ||
| }); | ||
| console.log(`您的字库完整路径前缀是:${that.prefixPath}cdn/`); | ||
| console.log(`您的cdn完整路径前缀是:${that.prefixPath}cdn/`); | ||
| compilation.assets['index.html'] = toAsset(text); | ||
| console.log(that.cdnUrlList); | ||
| Promise.all(that.cdnUrlList.map(function (cdnUrl) { | ||
@@ -62,5 +64,6 @@ return download(cdnUrl.cdnUrl); | ||
| function download (url, compilation, cdnUrl) { | ||
| function download (url) { | ||
| return new Promise(function (resolve, reject) { | ||
| http.get('http:' + url, function (resp) { | ||
| const agency = url.includes('https')? https : http; | ||
| agency.get(url, function (resp) { | ||
| if (resp.statusCode === 200) { | ||
@@ -67,0 +70,0 @@ let str = ''; |
+1
-1
| { | ||
| "name": "webpack-cdn2local-plugin", | ||
| "version": "1.2.1", | ||
| "version": "1.2.2", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Network access
Supply chain riskThis module accesses the network.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
3758
2.37%84
3.7%1
-50%2
100%