Skip to content

Commit

Permalink
fix(module-tools): resolve.tsConfig.configFilePath default value sh…
Browse files Browse the repository at this point in the history
…ould work (#6526)
  • Loading branch information
SoonIter authored Nov 11, 2024
1 parent 02ab20e commit ee10e41
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
4 changes: 1 addition & 3 deletions packages/solutions/module-tools/src/config/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions packages/solutions/module-tools/src/config/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ee10e41

Please sign in to comment.