From 0b5fe4ee5b712aa510b890e34daad421bc3c8aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=B8=85=E8=A5=BF?= <928200407@qq.com> Date: Wed, 9 Oct 2024 15:41:31 +0800 Subject: [PATCH 1/2] fix(api-core): find forgeConfig file --- packages/api/core/src/util/forge-config.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/api/core/src/util/forge-config.ts b/packages/api/core/src/util/forge-config.ts index 39fb672252..f346530330 100644 --- a/packages/api/core/src/util/forge-config.ts +++ b/packages/api/core/src/util/forge-config.ts @@ -124,7 +124,14 @@ export default async (dir: string): Promise => { forgeConfig = packageJSON.config && packageJSON.config.forge ? packageJSON.config.forge : null; } - if (!forgeConfig || typeof forgeConfig === 'string') { + if (forgeConfig && typeof forgeConfig === 'string') { + const pathToConfig = path.resolve(dir, forgeConfig); + if (!rechoir.prepare(interpret.extensions, pathToConfig, dir)) { + throw new Error(`Not found interpret for config file[${pathToConfig}]`); + } + } + + if (!forgeConfig) { for (const extension of ['.js', ...Object.keys(interpret.extensions)]) { const pathToConfig = path.resolve(dir, `forge.config${extension}`); if (await fs.pathExists(pathToConfig)) { From 88aeee28be44fc5e5af8c28cfa2b9d1f7b8b2e5b Mon Sep 17 00:00:00 2001 From: George Xu <33054982+georgexu99@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:25:12 -0800 Subject: [PATCH 2/2] Update packages/api/core/src/util/forge-config.ts Co-authored-by: Kevin Cui --- packages/api/core/src/util/forge-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/core/src/util/forge-config.ts b/packages/api/core/src/util/forge-config.ts index f346530330..ffd84e1488 100644 --- a/packages/api/core/src/util/forge-config.ts +++ b/packages/api/core/src/util/forge-config.ts @@ -127,7 +127,7 @@ export default async (dir: string): Promise => { if (forgeConfig && typeof forgeConfig === 'string') { const pathToConfig = path.resolve(dir, forgeConfig); if (!rechoir.prepare(interpret.extensions, pathToConfig, dir)) { - throw new Error(`Not found interpret for config file[${pathToConfig}]`); + throw new Error(`Not found interpret for config file: ${pathToConfig}`); } }