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

Compilation time grows with project size due to type-checking #243

Closed
sebald opened this issue Oct 15, 2019 · 8 comments · Fixed by #307
Closed

Compilation time grows with project size due to type-checking #243

sebald opened this issue Oct 15, 2019 · 8 comments · Fixed by #307
Labels
kind: optimization Performance, space, size, etc improvement

Comments

@sebald
Copy link
Contributor

sebald commented Oct 15, 2019

Current Behavior

When projects grow, transpilation time of TypeScript tends to grow with it because of the type checking. And while having types is awesome, especially when developing the longer compilation time is meh. Especially because most of the time your editor will tell you anyway that you messed up.

Desired Behavior

Possibility to opt out of type checking.

Suggested Solution

Add option (e.g. --transpileOnly) to skip type checking all together.
This can be directly passed to the rollup plugin as an option. See docs.

In addition, we could also add a cli command that does only the type checking (e.g. tsdx typecheck). So people who are opted out, can still easily run diagnostics.

Who does this impact? Who is this for?

Everyone who runs into slow builds.

I tried to switch a project to tsdx and the build time grew to 6min (sometime I even got a heap overflow error from V8 .... uuuuups). The project is very small, but the types seems to be very expensive. Removing type checking dropped the build time to 10s.

Describe alternatives you've considered

Not using tsdx and configuring rollup ourselves. Noooes!

Additional context

If this proposal sounds good, I am more than happy to work on it 🙂

@swyxio

This comment has been minimized.

@audiolion
Copy link
Contributor

IIRC create react app solved this issue by using the webpack plugin fork-ts-checker so that the bundle would still be emitted quickly and type checking would happen asynchronously sometime afterward

@sebald
Copy link
Contributor Author

sebald commented Oct 16, 2019

@sw-yx do you mean the flag from the TS compiler? That is what we are using before. But the CI is running for 6mins, if no heap overflow happens. Because there is no cache.

@audiolion yes! That's kind of what I am suggesting here :) Checking out https://github.com/wessberg/rollup-plugin-ts/, there seems to be no option to do this right now. Which is fine, since --noEmit does the trick as well.

@jaredpalmer
Copy link
Owner

Can someone add a section of about this to the docs?

@wessberg
Copy link

@sebald, it is possible to pass a transpileOnly option to rollup-plugin-ts which may help you here.

@sebald
Copy link
Contributor Author

sebald commented Oct 18, 2019

@wessberg Yes, that was my proposal 🙂 I locally tried that and as mentioned it dropped build time to seconds (from minutes).

@swyxio
Copy link
Collaborator

swyxio commented Nov 4, 2019

i think we'd take a PR for this. good flag to have.

@sebald
Copy link
Contributor Author

sebald commented Nov 5, 2019

Working on it! :)

sebald added a commit to sebald/tsdx that referenced this issue Nov 5, 2019
jaredpalmer pushed a commit that referenced this issue Dec 19, 2019
* add --transpileOnly flag

Ref #243

* Document --transpileOnly flag

* Make test check that stuff is build

* fix anchor id

* remove shorthand

* remove docs
@agilgur5 agilgur5 added the kind: optimization Performance, space, size, etc improvement label Mar 10, 2020
Repository owner locked as resolved and limited conversation to collaborators Aug 22, 2020
@agilgur5 agilgur5 changed the title Compilation time grows with project size Compilation time grows with project size due to type-checking Aug 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: optimization Performance, space, size, etc improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants