-
-
Notifications
You must be signed in to change notification settings - Fork 955
fix(transformer-attributify-jsx): ignore .md and .mdx files to avoid parser errors #5013
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
Conversation
✅ Deploy Preview for unocss ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
commit: |
|
I don't think we can remove support for Alternatively, we could fall back to plain text transform when babel parse throw an error. I think this is a bit troublesome. |
|
Okay, let me think about how to solve this |
|
I've updated the PR with a try-catch block and a regex fallback for .md/.mdx files. Please verify |
| export default { | ||
| plugins: { | ||
| unocss: plugin, | ||
| '@unocss': plugin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a unrelated change and it's also a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified it.
…n Babel parsing fails - Add regex-based fallback transformation for Markdown files - Wrap Babel parsing in try-catch with graceful error handling - Fallback to regex patterns for .md/.mdx files when AST parsing fails - Maintain Babel AST parsing for JSX/TSX files (high performance) - Update default include pattern to explicitly support .mdx files - Fixes unocss#4999
1f92f78 to
6791208
Compare
Since version 0.64.0,
transformer-attributify-jsxswitched to@babel/parser, which treats the content as strict JS/TS. It fails when parsing.mdor.mdxfiles (e.g., due to Frontmatter or Markdown syntax), causing build errors in frameworks like Astro.This PR adds a check to explicitly ignore
.mdand.mdxfiles intransformer-attributify-jsxto prevent these parser crashes, as this transformer is intended for JSX/TSX content.Fixes #4999