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

Explore a potential SWC integration #140

Open
mikearnaldi opened this issue Apr 8, 2022 · 2 comments
Open

Explore a potential SWC integration #140

mikearnaldi opened this issue Apr 8, 2022 · 2 comments

Comments

@mikearnaldi
Copy link
Member

We could leverage a combination of SWC plugins https://swc.rs/docs/usage/plugins and the LanguageService API to enable direct compilation with SWC.

PROS:

  • maybe speed improvements, typescript would only need to type-check and provides its context to the plugin
  • smooth integration with next.js out of the box
  • vite integration via rollup plugins https://github.com/egoist/unplugin-swc

CONS:

  • maybe problematic to keep consistency between files in the language services and files in swc, ideally a plugin would call some kind of processCallExpressionAtLocation etc
@patroza
Copy link

patroza commented Apr 9, 2022

I like the premise, obviously.
The question is if this makes sense until SWC plugin v2 comes out, or if that would be a swift upgrade.
Also the TS processing will be a bottleneck for the otherwise fast SWC, but I agree that it may still be beneficial for performance, and the integration for nextjs etc is especially a bonus.

Perhaps some of the bottleneck could be alleviated by leveraging a language server that keeps running in the background?
Perhaps even one shared between editor and swc, though the editor one by default of course only focusses on open files.
In my current workflow with TS compiler running in background in watch mode, I always feel like double work is being done.

@mikearnaldi
Copy link
Member Author

mikearnaldi commented Apr 9, 2022

Might make sense to wait until v2 comes out if it ever will (there are discussions on keeping v1). As of the point on double work I believe the language server picks up the compiled from the background but I am not 100% sure. The idea is indeed something similar to the language server without the server protocol that can potentially be even parallel for. I don't see the ts compiler as a bottleneck but as the only thing in the pipe that does semantic stuff, an integration with swc should save on double file output, source maps linking etc but ofc it's all theoretical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants