-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Use SWC with ts-node #3696
base: main
Are you sure you want to change the base?
Use SWC with ts-node #3696
Conversation
Currently, we use `ts-node` to run scripts written in TypeScript. By default `ts-node` has some overhead because it typechecks the code it runs. For instance, running the `update-readme-content` script takes around 2 seconds to run in full. In other projects, we've solved this by integrating `ts-node` with SWC, which is faster because it avoids typechecking, a step we don't need to perform for scripts (as we can rely on `yarn build` in CI or TypeScript editor integration). This gets us to around 1.4 seconds for `update-readme-content`. This is still a lot for a simple script, but it is an improvement.
b1dae22
to
9f28a25
Compare
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
Using SWC makes sense but we should ensure we still get these type checked somewhere. e.g. maybe as part of the lint step. |
Yeah, maybe this isn't a good idea right now. The way that we've structured our TypeScript config is pretty confusing at the moment and I'm actually not sure how any of the scripts are getting typechecked at all (considering that they aren't included in the root |
Explanation
Currently, we use
ts-node
to run scripts written in TypeScript. By defaultts-node
has some overhead because it typechecks the code it runs. For instance, running theupdate-readme-content
script takes around 2 seconds to run in full.In other projects, we've solved this by integrating
ts-node
with SWC, which is faster because it avoids typechecking, a step we don't need to perform for scripts (as we can rely onyarn build
in CI or TypeScript editor integration). This gets us to around 1.4 seconds forupdate-readme-content
. This is still a lot for a simple script, but it is an improvement.Changelog
(None)
Checklist