# upload-ali-oss-plugin

> a webpack plugin of upload file to ali-oss

Latest version **1.0.1** (published 2021-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install upload-ali-oss-plugin
pnpm add upload-ali-oss-plugin
yarn add upload-ali-oss-plugin
bun add upload-ali-oss-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-03-15 |
| First published | 2021-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | stone |
| Maintainers | stonehelei |
| Keywords | webpack, plugin, ali-oss |

## Links

- npm: https://www.npmjs.com/package/upload-ali-oss-plugin
- Repository: https://github.com/MrLeihe/ali-oss-plugin
- Homepage: https://github.com/MrLeihe/ali-oss-plugin#readme
- Issues: https://github.com/MrLeihe/ali-oss-plugin/issues
- npm.io page: https://npm.io/package/upload-ali-oss-plugin

## Dependencies (3)

- [slash](https://npm.io/package/slash.md) ^3.0.0
- [globby](https://npm.io/package/globby.md) ^10.0.1
- [ali-oss](https://npm.io/package/ali-oss.md) ^6.13.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-03-15
- 1.0.0 — 2021-03-15

## README

## upload-ali-oss-plugin

A webpack plugin to upload assets to aliyun oss

一个上传文件到 `阿里云oss` 的 `webpack` 插件。

### 使用

1. 安装包

```bash
$ npm install upload-ali-oss-plugin -D
or
$ yarn add upload-ali-oss-plugin -D
```

2. 在 config 文件中引入，添加到 plugins

```javascript
const AliOssPlugin = require('upload-ali-oss-plugin')

// webpack config, oss 配置
const { OSS } = require('./oss')

new AliOssPlugin({
  region: OSS.REGION,
  accessKeyId: OSS.ACCESS_KEY_ID,
  accessKeySecret: OSS.ACCESS_KEY_SECRET,
  bucket: OSS.BUCKET,
  ossPath: OSS.PREFIX,
})

// oss.js，记得添加到 .gitignore，不要暴露到外网
module.exports = {
  OSS: {
    ACCESS_KEY_ID: 'your key',
    ACCESS_KEY_SECRET: 'your secret',
    BUCKET: 'your bucket',
    REGION: 'oss-cn-shenzhen',
    PREFIX: '要上传到的 oss 目录',
  },
}
```

### options 说明

|      参数       |           说明           |  类型   |         默认值         | 是否必填 |
| :-------------: | :----------------------: | :-----: | :--------------------: | :------: |
|     region      |      阿里云上传区域      | String  |    oss-cn-hangzhou     |          |
|   accessKeyId   |   阿里云的 accessKeyId   | String  |           -            |    是    |
| accessKeySecret | 阿里云的 accessKeySecret | String  |           -            |    是    |
|     bucket      |    上传到哪个 bucket     | String  |           -            |    是    |
|      debug      |         调试开关         | Boolean |         false          |          |
|     ossPath     | 上传到 bucket 的哪个目录 | String  | ''（不传则默认根目录） |          |
|    patterns     |    需要上传的文件规则    |  Array  |                        |          |
|     verbose     |     是否展示详细日志     | Boolean |          true          |          |
|     timeout     |       上传超时时间       | Number  |      60（单位秒）      |          |
|    overwrite    |     是否覆盖同名文件     | Boolean |         false          |          |

---
_Source: https://npm.io/package/upload-ali-oss-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
