admin管理员组文章数量:1125922
I'm trying to reduce incremental build time of tsc. In general when a file's "shape"(it's declaration file) is changed, tsc compiler will use "referenceMap" to find all files referencing it. And all of them will be checked.
Consider the following case:
If we modify a file, and just add a new export for it, even though no other file is using the exported element, we still need to check all files referencing it because it's shape is changed. But actually we can just check this file only.
So, is it possible that we do incremental build more precisely, like: find the exported element that changed(or may be affected by our changes) and only check files that using this element in incremental build.
I found it was difficult though, and wondering why tsc didn't do that?
A more specific sample:
fileA.ts:
export class A {
prop = 1;
}
fileB.ts:
import {A} from './fileA'
...(some code)
export {A};
fileC.ts:
import {A} from './fileB'
...(some code)
So, we have the referenceMap of "fileA->fileB->fileC". If we modified fileA.ts to:
export class A {
prop = "1";
}
We definitely need to check fileA, fileB, and fileC because fileA's shape has been changed. But, if we only add an export element that no other file is using it:
export class A {
prop = 1;
}
export let A1 = 1;
Tsc still need to check fileA, fileB, and fileC.
Is it possible that we do incremental build based on the relationship of symobols?
So that we can reduce the files that we need to check in incremental build.
In the case above, since no other file is using 'A1', we only need to check fileA.
本文标签:
版权声明:本文标题:typescript - Is it possible that we do incremental build based on symbols? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736662657a1946493.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论