Skip to content

tsconfig extends property makes tsc scanning files its shouldn't (causing serious slowdown on compilation) #14539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bnaya opened this issue Mar 8, 2017 · 0 comments · Fixed by #15139
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@Bnaya
Copy link

Bnaya commented Mar 8, 2017

TypeScript Version: 2.2.1

Description of the issue:
When a tsconfig extends another tsconfig-base,
tsc will scan all of the files and directories that are siblings of the extended tsconfig-base, including any node modules and unrelated files.
Probably tsc thinks its also a program root(?)
Even that the docs specifics that files, include and exclude from the inheriting config file overwrite those from the base config file.

A side note: adding include: [] tsconfig-base solved the issue. but the default behaviour is problematic.

On this travis build log you can see the output of strace on tsc with a repro of the described behaviour, listing all of the stat operations.
You can see that there are alot of files that not supposed to be accessed by the tsc, being lstat
https://travis-ci.org/brandtotal/missbehave-tsconfig-extend/jobs/208978852

A sample of the log:

...
stat("/home/travis/build/brandtotal/missbehave-tsconfig-extend/bad-test-case/tsconfig-base.json", {st_mode=S_IFREG|0664, st_size=148, ...}) = 0
fstat(9, {st_mode=S_IFREG|0664, st_size=148, ...}) = 0
stat("/home/travis/build/brandtotal/missbehave-tsconfig-extend/bad-test-case/proj1", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
stat("/home/travis/build/brandtotal/missbehave-tsconfig-extend/bad-test-case/this-file-is-not-expected-to-be-lstat-by-tsc.ts", {st_mode=S_IFREG|0664, st_size=0, ...}) = 
...

On the good test-case, where i've added include: [] to the tsconfig-base, there is not access to this-file-is-not-expected-to-be-lstat-by-tsc.ts

The code is available here:
https://github.com/brandtotal/missbehave-tsconfig-extend

On small projects and fast machines its not very noticeable.
On complex projects it can make tsc stat hundreds of thousands of files, causing serious slowdown.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Mar 8, 2017
@mhegazy mhegazy added this to the TypeScript 2.3 milestone Mar 9, 2017
@mhegazy mhegazy assigned ghost Mar 9, 2017
@ghost ghost closed this as completed in #15139 May 8, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label May 8, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants