@stellaris/vite-plugin-tencent-oss
Version:
Upload the production files bundled in the project to Tencent CSS, except for html
35 lines (32 loc) • 983 B
JavaScript
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vitePluginTencentOss from "../index.js";
const testOptions = {
region: "ap-beijing",
secretId: "test-secret-id",
secretKey: "test-secret-key",
bucket: "test-bucket-1234567890",
overwrite: true,
enabled: true,
test: true, // 启用测试模式,不会真实上传
lastCommitGlobs: [
"**/*.html", // 最后上传所有 HTML 文件
"**/index.*.js", // 最后上传入口 JS 文件
],
};
// https://vitejs.dev/config/
export default defineConfig({
base: "https://test-static.example.com/app/", // 测试用的 CDN 地址
plugins: [vue(), vitePluginTencentOss(testOptions)],
build: {
outDir: 'dist-test',
rollupOptions: {
output: {
// 确保生成的文件名包含 hash
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash].[ext]'
}
}
}
});