Socket
Book a DemoInstallSign in
Socket

vite-oss-upload

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-oss-upload

Upload the production files bundled in the project to Ali OSS

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-80%
Maintainers
0
Weekly downloads
 
Created
Source

vite-oss-upload

将项目中打包后生产文件上传到 Ali OSS

功能特性

效果预览:

image

安装

npm i -D vite-oss-upload@latest
or
yarn add -D vite-oss-upload@latest
or
pnpm i -D vite-oss-upload@latest

基本使用

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

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import viteOssUpload from "vite-oss-upload";

const options = {
  dist: "/", // bucket根目录
  region: "<Your Region>",
  accessKeyId: "<Your Access Key ID>",
  accessKeySecret: "<Your Access Key Secret>",
  bucket: "<Your Bucket>",
  overwrite: true, // 覆盖已存在文件
};

const prod = process.env.NODE_ENV === "production";

export default defineConfig({
  plugins: [vue(), vitePluginAliOss(options)],
});

打包发布生产代码

npm run build

插件将会在打包完成后,上传 vite 配置 outDir 路径下的所有资源文件。

配置项

optionsdescriptiontypedefault
dist需要上传到 oss 上的文件目录string
region阿里云 oss 地域string
accessKeyId阿里云 oss 访问 IDstring
accessKeySecret阿里云 oss 访问密钥string
bucket阿里云 oss 存储空间名称string
overwrite如果文件已存在,是否覆盖booleanfalse
ignore文件忽略规则。如果你使用空字符串 '',将不会忽略任何文件boolean'**/*.html'
headers请求头设置,详细信息请见 https://www.alibabacloud.com/help/zh/doc-detail/31978.htmlobject{}
test仅测试路径,不会有文件上传booleanfalse
enabled是否启用本插件booleantrue
...其他初始化 oss 的参数,详细信息请见 https://www.alibabacloud.com/help/zh/doc-detail/64097.htmlany

Keywords

vite-plugin

FAQs

Package last updated on 27 Feb 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.