diff --git a/packages/document/module-doc/docs/en/api/config/build-config.mdx b/packages/document/module-doc/docs/en/api/config/build-config.mdx index d512169bdbb1..60a6d8a15144 100644 --- a/packages/document/module-doc/docs/en/api/config/build-config.mdx +++ b/packages/document/module-doc/docs/en/api/config/build-config.mdx @@ -1089,7 +1089,7 @@ type Tsconfig = { ``` - **Default**: `{ configFile: './tsconfig.json', references: undefined }` -- **Version**: `>=MAJOR_VERSION.60.5` +- **Version**: `>=MAJOR_VERSION.61.1` ```js title="modern.config.ts" export default defineConfig({ diff --git a/packages/document/module-doc/docs/zh/api/config/build-config.mdx b/packages/document/module-doc/docs/zh/api/config/build-config.mdx index 488f68869488..91bb8facbf4c 100644 --- a/packages/document/module-doc/docs/zh/api/config/build-config.mdx +++ b/packages/document/module-doc/docs/zh/api/config/build-config.mdx @@ -1075,7 +1075,7 @@ type Tsconfig = { ``` - 默认值: `{ configFile: config.tsconfig, references: undefined }` -- 版本:`>=MAJOR_VERSION.60.5` +- 版本:`>=MAJOR_VERSION.61.1` ```js title="modern.config.ts" export default defineConfig({ diff --git a/packages/solutions/module-tools/src/builder/esbuild/index.ts b/packages/solutions/module-tools/src/builder/esbuild/index.ts index df69acefd400..6eaea345968e 100644 --- a/packages/solutions/module-tools/src/builder/esbuild/index.ts +++ b/packages/solutions/module-tools/src/builder/esbuild/index.ts @@ -94,7 +94,7 @@ export class EsbuildCompiler implements ICompiler { root, platform: config.platform, alias: config.alias, - tsConfig: config.resolve?.tsConfig, + tsConfig: config.resolve.tsConfig, mainFields: config.resolve.mainFields, }; diff --git a/packages/solutions/module-tools/src/config/merge.ts b/packages/solutions/module-tools/src/config/merge.ts index 8bda5cf769a4..fdcb10fa1128 100644 --- a/packages/solutions/module-tools/src/config/merge.ts +++ b/packages/solutions/module-tools/src/config/merge.ts @@ -112,9 +112,7 @@ export const mergeDefaultBaseConfig = async ( alias: mergedResolveAlias, tsConfig: pConfig.resolve?.tsConfig ?? - (pConfig.tsconfig - ? { configFile: pConfig.tsconfig } - : defaultConfig.resolve.tsConfig), + (tsconfig ? { configFile: tsconfig } : defaultConfig.resolve.tsConfig), }; const esbuildOptions = pConfig.esbuildOptions ?? defaultConfig.esbuildOptions; diff --git a/packages/solutions/module-tools/src/config/normalize.ts b/packages/solutions/module-tools/src/config/normalize.ts index e308bf90ae93..df505e0c2350 100644 --- a/packages/solutions/module-tools/src/config/normalize.ts +++ b/packages/solutions/module-tools/src/config/normalize.ts @@ -119,6 +119,14 @@ export const transformToAbsPath = async ( newConfig.tsconfig = path.resolve(context.appDirectory, newConfig.tsconfig); + // resolve.tsConfig + if (newConfig.resolve.tsConfig) { + newConfig.resolve.tsConfig.configFile = path.resolve( + context.appDirectory, + newConfig.resolve.tsConfig.configFile, + ); + } + // dts path if (newConfig.dts) { newConfig.dts.distPath = path.resolve(