Gathering detailed insights and metrics for webpack-aliyun-oss-copy
Gathering detailed insights and metrics for webpack-aliyun-oss-copy
Gathering detailed insights and metrics for webpack-aliyun-oss-copy
Gathering detailed insights and metrics for webpack-aliyun-oss-copy
一个webpack(version >= 4)插件,上传资源到阿里云oss。可以作为webpack插件使用,也可独立使用
npm install webpack-aliyun-oss-copy
Typescript
Module System
Node Version
NPM Version
JavaScript (97.7%)
HTML (2.3%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
70 Stars
61 Commits
40 Forks
2 Watchers
12 Branches
2 Contributors
Updated on Nov 20, 2024
Latest Version
0.5.9
Package Id
webpack-aliyun-oss-copy@0.5.9
Unpacked Size
14.29 kB
Size
5.40 kB
File Count
4
NPM Version
8.19.2
Node Version
18.10.0
Published on
Jul 20, 2023
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
5
A webpack(version>=4) plugin to upload assets to aliyun oss, u can use it with or without webpack.
一个webpack(version>=4)插件,上传资源到阿里云oss。可以作为webpack插件使用,也可独立使用
buildRoot
的文件路径上传(保留原文件路径的层级结构)。setOssPath
重新配置不同的上传路径。1$ npm i webpack-aliyun-oss -D
from
: 上传哪些文件,支持glob方式,如'./build/**', 可以为glob字符串或者数组。
dist
: 上传到oss哪个目录下,默认为oss根目录。可作为路径前缀使用。ossOptions
: OSS相关参数配置。
region
: 阿里云上传区域accessKeyId
: 阿里云的授权accessKeyIdaccessKeySecret
: 阿里云的授权accessKeySecretbucket
: 上传到哪个bucketstsToken
: security-token, 可选timeout
: oss超时设置,默认为30秒(30000)overwrite
: 是否覆盖oss同名文件。默认falseparallel
: 并发上传个数。默认5deleteOrigin
: 上传完成是否删除原文件,默认falsesetOssPath
: 自定义每个文件上传路径。接收参数为当前文件路径。不传,或者所传函数返回false则按默认方式上传。setHeaders
: 配置headers的函数。接收参数为当前文件路径。不传,或者所传函数返回false则不设置header。buildRoot
: 构建目录。如:path/to/your/files。独立使用时候需要传。如果已传setOssPath
可忽略。默认为当前工作目录。test
: 测试,仅查看文件和上传路径,但是不执行上传操作。默认falsebail
: 出错是否中断上传。默认falselogToLocal
: 出错信息写入本地upload.error.log。默认falseaccessKeyId, accessKeySecret
很重要,注意保密!!!1const WebpackAliyunOss = require('webpack-aliyun-oss'); 2const webpackConfig = { 3 // ... 省略其他 4 plugins: [new WebpackAliyunOss({ 5 from: ['./build/**', '!./build/**/*.html'], // build目录下除html之外的所有文件 6 dist: '/path/in/alioss', // oss上传目录 7 ossOptions: { 8 region: 'your region', 9 accessKeyId: 'your key', 10 accessKeySecret: 'your secret', 11 bucket: 'your bucket', 12 stsToken: '<security-token>', // 可选 13 }, 14 15 // 如果希望自定义上传路径,就传这个函数 16 // 否则按 output.path (webpack.config.js) 目录下的文件路径上传 17 setOssPath(filePath) { 18 // filePath为当前文件路径。函数应该返回路径+文件名。 19 // 如果返回/new/path/to/file.js,则最终上传路径为 /path/in/alioss/new/path/to/file.js 20 return '/new/path/to/file.js'; 21 }, 22 23 // 如果想定义header就传 24 setHeaders(filePath) { 25 // 定义当前文件header,可选 26 return { 27 'Cache-Control': 'max-age=31536000' 28 } 29 } 30 })] 31}
1const WebpackAliyunOss = require('webpack-aliyun-oss'); 2new WebpackAliyunOss({ 3 from: ['./build/**', '!./build/**/*.html'], 4 dist: '/path/in/alioss', 5 buildRoot: 'build', // 构建目录,如果已传setOssPath,可忽略 6 ossOptions: { 7 region: 'your region', 8 accessKeyId: 'your key', 9 accessKeySecret: 'your secret', 10 bucket: 'your bucket', 11 stsToken: '<security-token>', // 可选 12 }, 13 14 // 如果希望自定义上传路径,就传这个函数 15 // 否则按`buildRoot`下的文件结构上传 16 setOssPath(filePath) { 17 // filePath为当前文件路径。函数应该返回路径+文件名。 18 // 如果返回/new/path/to/file.js,则最终上传路径为 /path/in/alioss/new/path/to/file.js 19 return '/new/path/to/file.js'; 20 }, 21 22 // 如果想定义header就传 23 setHeaders(filePath) { 24 return { 25 'Cache-Control': 'max-age=31536000' 26 } 27 } 28}).apply();
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
43 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