mirror of https://github.com/fantasticit/think.git
fix(client): don't import config in runtime
This commit is contained in:
parent
14fba024ac
commit
28736a5881
|
@ -10,6 +10,7 @@ const nextConfig = semi({
|
||||||
env: {
|
env: {
|
||||||
SERVER_API_URL: config.apiUrl,
|
SERVER_API_URL: config.apiUrl,
|
||||||
COLLABORATION_API_URL: config.collaborationUrl,
|
COLLABORATION_API_URL: config.collaborationUrl,
|
||||||
|
ENABLE_ALIYUN_OSS: config?.oss?.aliyun?.accessKeyId,
|
||||||
},
|
},
|
||||||
webpack: (config, { dev, isServer }) => {
|
webpack: (config, { dev, isServer }) => {
|
||||||
config.resolve.plugins.push(new TsconfigPathsPlugin());
|
config.resolve.plugins.push(new TsconfigPathsPlugin());
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
import { getConfig } from "@think/config";
|
|
||||||
import { HttpClient } from "./HttpClient";
|
import { HttpClient } from "./HttpClient";
|
||||||
|
|
||||||
const config = getConfig();
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const hasOssConfig = config?.oss?.aliyun?.accessKeyId;
|
|
||||||
|
|
||||||
export const uploadFile = async (file: Blob): Promise<string> => {
|
export const uploadFile = async (file: Blob): Promise<string> => {
|
||||||
if (!hasOssConfig) {
|
if (process.env.ENABLE_ALIYUN_OSS) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error("阿里云OSS配置不完善,请自行实现上传文件!")
|
new Error("阿里云OSS配置不完善,请自行实现上传文件!")
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue