Skip to content

Use the Babel parser as a fallback when Acorn can’t parse code#13844

Merged
nachocodoner merged 1 commit intorelease-3.3.1from
babel-fallback-acorn
Jul 9, 2025
Merged

Use the Babel parser as a fallback when Acorn can’t parse code#13844
nachocodoner merged 1 commit intorelease-3.3.1from
babel-fallback-acorn

Conversation

@nachocodoner
Copy link
Copy Markdown
Member

@nachocodoner nachocodoner commented Jul 9, 2025

Context: #13800

This PR addresses a scenario where the acorn parser can’t handle certain code syntax and broke some apps using specific dependencies that require JSX parsing just by update to Meteor 3.3. The acorn parser is used as a faster alternative to Babel’s AST parser, and the SWC parser doesn’t yet support the AST format. This parser converts code to an AST and runs checks in the import scanner to enable features like global exported variables in packages.

Using acorn-jsx could fix this as well, but I’d rather add a fallback to solve any other syntax scenario and regression we haven’t encountered and Babel surely supports. Adding acorn-jsx would also require updating the reify package, which we want to leave unchanged to avoid new issues. Eventually, we’ll replace acorn with SWC once it supports AST and JSX. For now, the fallback to Babel is good enough.

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 9, 2025

Deploy Preview for v3-meteor-api-docs ready!

Name Link
🔨 Latest commit cc48324
🔍 Latest deploy log https://app.netlify.com/projects/v3-meteor-api-docs/deploys/686e6f657254ae0008cfee0e
😎 Deploy Preview https://deploy-preview-13844.docs.meteor.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nachocodoner nachocodoner mentioned this pull request Jul 9, 2025
@nachocodoner nachocodoner added this to the Release 3.3.1 milestone Jul 9, 2025
@nachocodoner nachocodoner marked this pull request as ready for review July 9, 2025 13:59
@nachocodoner nachocodoner merged commit 4bb8001 into release-3.3.1 Jul 9, 2025
10 checks passed
@nachocodoner nachocodoner deleted the babel-fallback-acorn branch July 9, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants