Skip to content

Commit 5ebc53f

Browse files
authored
perf(dts-plugin): enable tsbuildinfo (#3506)
1 parent 1448309 commit 5ebc53f

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

.changeset/cuddly-turkeys-cry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/dts-plugin': minor
3+
---
4+
5+
feat: enable tsc incremental build

apps/website-new/docs/en/guide/troubleshooting/type/TYPE-001.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ When compiling the exported (`exposes`) file TS type, the current project's `tsc
1010

1111
Execute the `cmd` command in the error message parameter in the terminal, and repair the file or `tsconfig` according to the error message.
1212

13+
If you want to ignore the type check error in ts, you can set [`compilerOptions.noCheck`](https://www.typescriptlang.org/tsconfig/#noCheck) to `true` in `tsconfig.json` (This option is only supported for ts 5.5 and above)
14+
1315
If the `cmd` command is executed without an error, but the error TS compilation fails is still reported, you need to check the `exposes` field in `ModuleFederationPlugin`:
1416

1517
```ts title="[modern|rspack|rsbuild|webpack].config.[js,ts]"

apps/website-new/docs/zh/guide/troubleshooting/type/TYPE-001.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import ErrorCodeTitle from '@components/ErrorCodeTitle';
1010

1111
在 terminal 中执行报错信息参数中的 `cmd` 命令,根据错误信息对文件或者 `tsconfig` 进行修复。
1212

13+
若你希望忽略 ts 中的类型检查错误,可在 `tsconfig.json` 中设置 [`compilerOptions.noCheck`](https://www.typescriptlang.org/tsconfig/#noCheck)`true`(该选项仅支持 ts 5.5 及以上版本)
14+
1315
`cmd` 命令执行无报错,但仍然报错 TS 编译失败,需要检查 `ModuleFederationPlugin` 中的 `exposes`字段:
1416

1517
```ts title="[modern|rspack|rsbuild|webpack].config.[js,ts]"

packages/dts-plugin/src/core/configurations/remotePlugin.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ describe('hostPlugin', () => {
5454
'dist/@mf-types/compiled-types',
5555
),
5656
rootDir: resolve(__dirname),
57+
incremental: true,
58+
tsBuildInfoFile: resolve(
59+
remoteOptions.context,
60+
'node_modules/.cache/.tsbuildinfo',
61+
),
5762
},
5863
files: ['./src/components/button', './src/components/anotherButton'],
5964
include: [],
@@ -118,6 +123,11 @@ describe('hostPlugin', () => {
118123
'dist/typesFolder/compiledTypesFolder',
119124
),
120125
rootDir: resolve(__dirname),
126+
incremental: true,
127+
tsBuildInfoFile: resolve(
128+
remoteOptions.context,
129+
'node_modules/.cache/.tsbuildinfo',
130+
),
121131
},
122132
exclude: [],
123133
include: [],

packages/dts-plugin/src/core/configurations/remotePlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ const readTsConfig = (
9797
noEmit: false,
9898
declaration: true,
9999
outDir,
100+
incremental: true,
101+
tsBuildInfoFile: resolve(context, 'node_modules/.cache/.tsbuildinfo'),
100102
};
101103

102104
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};

0 commit comments

Comments
 (0)