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

fix: update SWC to fix miscompilation of babel #66

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

lubieowoce
Copy link
Contributor

@lubieowoce lubieowoce commented Mar 15, 2024

This fixes an issue where, in production builds, SWC (pulled in via parcel's default optimizer, @parcel/optimizer-swc) was miscompiling Babel's parser in a way that broke parsing of x in y expressions. Yeah, I know.

Screenshot 2024-03-15 at 13 37 29

This can be easily reproduced by going to e.g. https://react.dev/reference/react/Suspense#usage and putting

if (!("abc" in {})) { console.log("blah"); }

anywhere in the code. It should be the same in any other sandpack-bundler-based sandbox, but i don't have a handy link.

Some more details of the investigation: https://x.com/lubieowoce/status/1768415425765704166?s=20

Luckily, this SWC bug was fixed in latest, so we can just make parcel use that via resolutions. I will also open a PR to update the SWC version used by parcel, but this is a quick fix that we can apply ourselves without waiting for them, so I don't see why not.

Copy link

codesandbox bot commented Mar 15, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@DeMoorJasper DeMoorJasper merged commit e236687 into codesandbox:main Mar 15, 2024
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.

2 participants