vite-plugin-cos
v0.0.5
Published
A vite plugin for upload dist files to tencent cloud cos
Downloads
14
Maintainers
Readme
vite-plugin-cos
Usage
Install
pnpm add vite-plugin-cos -D
Config
// in your vite.config.ts
const isProd = process.env.NODE_ENV === 'production';
const config = loadEnv('production', './');
{
base: isProd ? config.VITE_COS_BASE : '/',
plugins: [
cos({
bucket: config.VITE_COS_BUCKET,
secretId: config.VITE_COS_SECRETID,
secretKey: config.VITE_COS_SECRETKEY,
region: config.VITE_COS_REGION,
}),
];
}
# in your .env.production
VITE_COS_BASE=https://your-cos-cdn-domin.com/subdir/
VITE_COS_REGION=ap-xxx
VITE_COS_BUCKET=xxx-121212
VITE_COS_SECRETID=xxxxx
VITE_COS_SECRETKEY=xxxxx
Now, just coding....