zhangxiao
2024-08-26 57b66478e7e335379435b31c20da4619bd1411f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { generateVersion, AliConfig } from "@easyfe/vite-plugin-upload";
 
//是否允许上传到CDN
export const enableUpload = false;
 
//获取oss配置
export function getOssConfig(envMap: Record<string, any>) {
    //上传配置
    const uploadOption: AliConfig = {
        accessKeyId: "",
        accessKeySecret: "",
        bucket: "",
        region: "",
        bucketName: envMap.VITE_APP_MODE === "production" ? "dist" : "test",
        remoteDir: `project-template/${generateVersion()}`,
        from: "dist",
        excludesExtra: ["map"]
    };
    //上传路径
    const uploadPath = `${envMap.VITE_APP_CDN_URL}/${uploadOption.bucketName}/${uploadOption.remoteDir}/`;
    return { uploadPath, uploadOption };
}