将打包编译好的文件上传到阿里云oss,每次打包后自动上传文件
根据阿里云技术文档提供的上传API进行开发
npm install kumi-upload-oss -S
import uploadForOss from 'kumi-upload-oss';
### 以下参数加入到budil/build.js中
const uploadPath = '/usr/xxx/dist/';
const accessKeyId = '<accessKeyId>';
const accessKeySecret = '<accessKeySecret>';
const region = '<oss-cn-qingdao>';
const bucket = '<bucket name>';
### 在打包结束后执行此方法
uploadForOss.upload(uploadPath, accessKey, secretKey, zone, bucket);
Param | Description |
---|---|
accessKeyId | 阿里云accessKeyId |
accessKeySecret | 阿里云accessKeySecret |
uploadPath | 文件的绝对路径 |
region | 空间区域,参考链接 |
bucket | 空间名称 |