Skip to content
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

TypeScript performance during watch mode #7309

Closed
deftomat opened this issue Jul 2, 2019 · 5 comments
Closed

TypeScript performance during watch mode #7309

deftomat opened this issue Jul 2, 2019 · 5 comments

Comments

@deftomat
Copy link
Contributor

deftomat commented Jul 2, 2019

CRA performance can still be a pain with TypeScript.

We already reduce the waiting times for type-check by #5903, then we speed it up even more by using the IncrementalAPI in fork-ts-checker-webpack-plugin.

Unfortunately, even after all of these improvements, type-check can took 5 or more seconds to finish in big projects. Yes, it's much better now as you can see your changes immediately and type-errors will appear when they are ready.

Now, the important thing:

I discover that using the isolatedModules: false in tsconfig.json reduces type-checks between code changes from 5 seconds to less than 1 second.

I know the reason, why we are using isolatedModules - it is a limitation of Babel compiler. However, we should definitely do something with it as developers are required to wait a lot of time just to catch a few edge cases.

I'm not sure how to solve it right now but I'm pretty sure that we can figure it out together.

cc @johnnyreilly (creator of fork-ts-checker-webpack-plugin)

@johnnyreilly
Copy link
Contributor

Credit where it's due: @piotr-oles is the creator of fork-ts-checker-webpack-plugin - I've just worked on it an awful lot. And I'm louder 😁

In ts-loader we did fiddling with isolatedModules. I've actually forgotten most of the details. However here's some links that should provide some useful info:

microsoft/TypeScript#16351

TypeStrong/ts-loader#569

@Bnaya
Copy link

Bnaya commented Jul 3, 2019

I'm curious: if you run standalone tsc -w --notEmit,
How much time does the typecheck takes? (with and without isolatedModules )

@deftomat
Copy link
Contributor Author

deftomat commented Jul 4, 2019

@Bnaya The same happens for tsc -w --noEmit. So, its definitely the behaviour of TypeScript itself.

Looks like isolatedModules has some serious performance implications.

@deftomat
Copy link
Contributor Author

Looks like it is a bug in TypeScript itself: microsoft/TypeScript#32294

@deftomat
Copy link
Contributor Author

Closing as fix will probably be available in TypeScript v3.7.

@lock lock bot locked and limited conversation to collaborators Sep 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants