Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
webpack-aliyun-oss
Advanced tools
a webpack(>=4) plugin to upload assets to aliyun oss, can be used with or without webpack.
A webpack(>=4) plugin to upload assets to aliyun oss, u can use it with or without webpack.
一个webpack(>=4)插件,上传资源到阿里云oss。可以作为webpack插件使用,也可独立使用(从0.1.0开始支持)
setOssPath
来配置不同的上传路径。setOssPath
指定上传路径, 否则将上传到dist
指定的路径下。$ npm i webpack-aliyun-oss -D
from
: 上传哪些文件,支持类似gulp.src的glob方法,如'./build/**', 可以为glob字符串或者数组。
dist
: 上传到oss哪个目录下,默认为oss根目录。可作为路径前缀使用。region
: 阿里云上传区域accessKeyId
: 阿里云的授权accessKeyIdaccessKeySecret
: 阿里云的授权accessKeySecretbucket
: 上传到哪个buckettimeout
: oss超时设置,默认为30秒(30000)overwrite
: 是否覆盖oss同名文件。默认trueverbose
: 是否显示上传日志,默认为truedeletOrigin
: 上传完成是否删除原文件,默认falsedeleteEmptyDir
: 如果某个目录下的文件都上传到cdn了,是否删除此目录。deleteOrigin为true时候生效。默认false。setOssPath
: 自定义上传路径的函数。接收参数为当前文件路径。不传,或者所传函数返回false则按默认路径上传。(默认为output.path下文件路径)setHeaders
: 配置headers的函数。接收参数为当前文件路径。不传,或者所传函数返回false则不设置header。buildRoot
: 构建目录名。如:build。独立使用时候需要。如果已传setOssPath可忽略。默认为空test
: 测试,仅显示要上传的文件,但是不执行上传操作。默认falseaccessKeyId, accessKeySecret
很重要,注意保密!!!const WebpackAliyunOss = require('webpack-aliyun-oss');
const webpackConfig = {
// ... 省略其他
plugins: [new WebpackAliyunOss({
from: ['./build/**', '!./build/**/*.html'],
dist: 'path/in/alioss',
region: 'your region',
accessKeyId: 'your key',
accessKeySecret: 'your secret',
bucket: 'your bucket',
setOssPath(filePath) {
// filePath为当前文件路径。函数应该返回路径+文件名。如果返回/new/path/to/file.js,则最终上传路径为 path/in/alioss/new/path/to/file.js
return '/new/path/to/file.js';
},
setHeaders(filePath) {
// 定义当前文件header,可选
return {
'Cache-Control': 'max-age=31536000'
}
}
})]
}
const WebpackAliyunOss = require('webpack-aliyun-oss');
new WebpackAliyunOss({
from: ['./build/**', '!./build/**/*.html'],
dist: 'path/in/alioss',
buildRoot: 'build', // 构建目录,如果已传setOssPath,可忽略
region: 'your region',
accessKeyId: 'your key',
accessKeySecret: 'your secret',
bucket: 'your bucket',
setOssPath(filePath) {
// filePath为当前文件路径。函数应该返回路径+文件名。如果返回/new/path/to/file.js,则最终上传路径为 path/in/alioss/new/path/to/file.js
return '/new/path/to/file.js';
},
setHeaders(filePath) {
// some operations to filePath
return {
'Cache-Control': 'max-age=31536000'
}
}
}).apply();
FAQs
a webpack(version>=4) plugin to upload assets to aliyun oss, can be used with or without webpack.
The npm package webpack-aliyun-oss receives a total of 16 weekly downloads. As such, webpack-aliyun-oss popularity was classified as not popular.
We found that webpack-aliyun-oss demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.