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] 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)) {