fix: dts may lost if another dts has error in last time #717
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复前序 d.ts 编译失败时部分 d.ts 丢失的问题。
原因是 father 启用了 ts 的 incremental 特性,它会自动增量编译文件,即便前序 d.ts 编译时部分源代码的类型有误,在第二次编译时它也会尽可能少地重新编译文件;father 会用持久缓存对这些不再重复编译的 d.ts 做补齐,但缓存写入逻辑仅在不存在类型诊断错误时才会执行,和 ts 的 incremental 行为不一致,最终导致产物中丢失部分 d.ts 文件。
解法是把写缓存的逻辑提前到检查类型诊断错误之前,无论如何都写入缓存。
cc @zombieJ