zxc-alioss
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

umi-plugin-alioss

umi,umi-plugin,alioss

基于 umi2.x 插件体系编写

说明

基于umi-plugin系统封装的一个插件,用于构建成功之后上传静态资源到阿里云

使用

yarn add umi-plugin-alioss -D
yarn add ali-oss -D

.umirc.js或者config/config.js中使用

const ossPluginOpt = {
  ossConfig: {
    region: 'oss-cn-beijing',
    bucket: 'example',
    secure: true,
  },
  configName: '.alioss',
  enabled: true,
  cdnPrefix: 'https://cdn.xxx.com/release/', // CDN前缀
  uploadPath: '/release', // 文件上传路径
  exclude: '', // 排除文件
  ignoreHtml: true, // 不上传html
};

export default {
  plugins: [['umi-plugin-alioss', ossPluginOpt]],
};

注意事项:

为了安全起见,alioss上传是需要accessKeyId,accessKeySecret的 我们在使用之前需要先到系统用户目录下新建.alioss文件,内容如下

accessKeyId=1231231231231
accessKeySecret=12312312312313

比如mac用户在/User/xxx/.alioss

windows用户在C:/User/admin/.alioss

注意:在服务器环境中需要给该文件设置读取权限比如:chmod 600 .alioss

1.0.2 更新

为了兼容umi3.x代码有些许改动

Readme

Keywords

Package Sidebar

Install

npm i zxc-alioss

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

21.7 kB

Total Files

6

Last publish

Collaborators

  • yiyiqiufeng