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

Replace SWC with Babel #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Replace SWC with Babel #30

wants to merge 2 commits into from

Conversation

Schniz
Copy link
Owner

@Schniz Schniz commented Jun 2, 2021

I don't really like it, but I have more confidence on this type of code. I guess it will be an open PR for now.

The SWC implementation is using parse and print, which is like transform. SWC always prints JS code AFAIK and will not keep TS code as-is, which is generally what I want. I do not like it because the behavior can change based on the tsconfig.json, for instance.

I used print because as I'm writing this code, SWC's spans are not aligned with the input. 😕 swc-project/swc#1366 — I guess I can somehow hack this (maybe accumulate the Program spans every time and subtract from that myself?) but I do not like this approach at all.

Using Babel I can leverage MagicString to remove only what I really really want, and nothing else. But I'm afraid that it will be slower.

@Schniz Schniz self-assigned this Jun 2, 2021
@vercel
Copy link

vercel bot commented Jun 2, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

remastered – ./packages/docs-site

🔍 Inspect: https://vercel.com/schniz/remastered/2AVX3gnMyzZWwAmV3FLa7ZEb75os
✅ Preview: https://remastered-git-replace-swc-with-babel-schniz.vercel.app

remastered-example-1 – ./packages/example-app

🔍 Inspect: https://vercel.com/schniz/remastered-example-1/4JwWq5jMwpND63vVXBY8V4MM85CM
✅ Preview: https://remastered-example-1-git-replace-swc-with-babel-schniz.vercel.app

remastered-example-tailwindcss – ./packages/example-app-tailwindcss

🔍 Inspect: https://vercel.com/schniz/remastered-example-tailwindcss/Ce116UfhRuLaoJMvQ2ktt1MKMX5F
✅ Preview: https://remastered-exa-git-replace-swc-with-babel-c403d3.vercel.app

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

Successfully merging this pull request may close these issues.

1 participant