# vite-ali-oss-plugin

> 打包后自动上传到阿里云OSS的vite插件

Latest version **1.1.3** (published 2022-12-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-12-28 |
| First published | 2022-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | 代码厨子 |
| Maintainers | hofeng |
| Keywords | vite, ts, javascript, js, 阿里云, oss, 对象存储 |

## Links

- npm: https://www.npmjs.com/package/vite-ali-oss-plugin
- Repository: https://github.com/spirits001/vite-ali-oss-plugin
- Homepage: https://aqicms.com/article/gAh6fJ4wom.html
- Issues: https://github.com/spirits001/vite-ali-oss-plugin/issues
- npm.io page: https://npm.io/package/vite-ali-oss-plugin

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^8.0.3
- [vite](https://npm.io/package/vite.md) ^4.0.3
- [ali-oss](https://npm.io/package/ali-oss.md) ^6.17.1
- [@types/glob](https://npm.io/package/@types/glob.md) ^8.0.0
- [@types/ali-oss](https://npm.io/package/@types/ali-oss.md) ^6.16.7

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.3 (latest) — 2022-12-28
- 1.1.2 — 2022-12-28
- 1.1.1 — 2022-12-28
- 1.1.0 — 2022-12-28
- 1.0.2 — 2022-12-26
- 1.0.1 — 2022-12-22
- 1.0.0 — 2022-12-22

## README

# 用于自动上传到阿里云OSS的vite插件

## 安装

通过npm安装

```bash
npm install vite-ali-oss-plugin -D
```

## 配置

设置option

```javascript
const options = {
  region: '', // oss所在的地区，例如杭州是 oss-cn-hangzhou
  accessKeyId: '', // 阿里云key
  accessKeySecret: '', //阿里云密钥
  bucket: '', // oss的存储桶名称
  overwrite: true, // 是否删除里面的内容
  basePath: '', // 默认就是放根目录，如果要放在某个文件夹，写： html 注意，前后都不要加 /
  enabled: true, // 是否启用自动上传
  ignore: '', // 文件忽略规则。如果你使用空字符串 '' ，将不会忽略任何文件
  headers: {}, // 请求头设置，详细信息见 https://help.aliyun.com/document_detail/31955.html
};
```

## 用法

在 vite.config.js 中注册本插件

```javascript
import { defineConfig } from 'vite'
import viteAliOssPlugin from 'vite-ali-oss-plugin'

const options = {
    region: '<Your Region>'
    accessKeyId: '<Your Access Key ID>',
    accessKeySecret: '<Your Access Key Secret>',
    bucket: '<Your Bucket>',
    overwrite: true,
}

export default defineConfig({
    plugins: [viteAliOssPlugin(options)]
})
```

最后build的时候，将自动上传

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