fix(client): don't import config in runtime

This commit is contained in:
fantasticit 2022-02-22 23:22:39 +08:00
parent 14fba024ac
commit 28736a5881
2 changed files with 2 additions and 7 deletions

View File

@ -10,6 +10,7 @@ const nextConfig = semi({
env: {
SERVER_API_URL: config.apiUrl,
COLLABORATION_API_URL: config.collaborationUrl,
ENABLE_ALIYUN_OSS: config?.oss?.aliyun?.accessKeyId,
},
webpack: (config, { dev, isServer }) => {
config.resolve.plugins.push(new TsconfigPathsPlugin());

View File

@ -1,13 +1,7 @@
import { getConfig } from "@think/config";
import { HttpClient } from "./HttpClient";
const config = getConfig();
// @ts-ignore
const hasOssConfig = config?.oss?.aliyun?.accessKeyId;
export const uploadFile = async (file: Blob): Promise<string> => {
if (!hasOssConfig) {
if (process.env.ENABLE_ALIYUN_OSS) {
return Promise.reject(
new Error("阿里云OSS配置不完善请自行实现上传文件")
);