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

Swc support for faster transpilation #779

Closed
cspotcode opened this issue Feb 11, 2019 · 8 comments
Closed

Swc support for faster transpilation #779

cspotcode opened this issue Feb 11, 2019 · 8 comments
Labels
enhancement external research Needs design work, investigation, or prototyping. Implementation uncertain. you can do this Good candidate for a pull request.

Comments

@cspotcode
Copy link
Collaborator

cspotcode commented Feb 11, 2019

I just wanted to drop this on the radar in case you hadn't seen it. swc is a transpiler written in Rust that's an order of magnitude faster than those written in JS.
https://swc-project.github.io

On the one hand it seems out of scope for ts-node.

On the other hand, people turn to ts-node when they want to run TS code without pre-compilation. It handles all the details: sourcemaps work, your tsconfig is respected, etc. If ts-node had a --useSwc mode that made it an order of magnitude faster (with caveats) I think people would find that very useful.

I imagine that the hypothetical --useSwc flag is invalid unless --transpileOnly is also specified. Or --useSwc implies --transpileOnly. swc can't perform typechecking.

@blakeembrey
Copy link
Member

That does look useful. I also see swc-project/swc#126. I wonder if it makes sense to have something more generic than ts-node for this sort of thing. E.g. node -r swc/register. With the way things are moving, it might be preferable to use a light-weight transpiler at runtime and compile time, and only use tsc for type checking with noEmit enabled.

@cspotcode
Copy link
Collaborator Author

cspotcode commented Feb 11, 2019 via email

@cspotcode
Copy link
Collaborator Author

I did a bit more poking around. swc isn't ready for primetime; I filed a few issues: https://github.com/swc-project/swc/issues/created_by/cspotcode

Hopefully it will be soon!

@wclr
Copy link
Contributor

wclr commented Mar 29, 2019

@blakeembrey
In TS 3.4 they also added incremental flag and option to speed up sequential builds, not sure if it affects ts-node buids?

@Suyashtnt
Copy link

any updates?

@cspotcode cspotcode added you can do this Good candidate for a pull request. research Needs design work, investigation, or prototyping. Implementation uncertain. labels Jun 9, 2020
@cspotcode
Copy link
Collaborator Author

@Suyashtnt marked as "help wanted" to indicate this will likely require an external contribution, a PR. Also "research" since they will need to figure out if SWC has fixed all their TypeScript bugs and figure out how to parse tsconfig files, converting them to SWC compiler flags.

@Brooooooklyn
Copy link

deno has used swc as their TypeScript compiler under --no-type-check flag.

@Brooooooklyn
Copy link

how to parse tsconfig files, converting them to SWC compiler flags.

Like this https://github.com/Brooooooklyn/swc-node/blob/master/packages/register/register.ts#L73 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement external research Needs design work, investigation, or prototyping. Implementation uncertain. you can do this Good candidate for a pull request.
Projects
None yet
Development

No branches or pull requests

5 participants