fix(transformer-attributify-jsx): ignore .md and .mdx files to avoid parser errors#5013
Closed
jack-old-archive wants to merge 3 commits into
Closed
fix(transformer-attributify-jsx): ignore .md and .mdx files to avoid parser errors#5013jack-old-archive wants to merge 3 commits into
jack-old-archive wants to merge 3 commits into
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: |
zyyv
approved these changes
Dec 8, 2025
Member
|
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. |
Contributor
Author
|
Okay, let me think about how to solve this |
Contributor
Author
|
I've updated the PR with a try-catch block and a regex fallback for .md/.mdx files. Please verify |
antfu
requested changes
Dec 14, 2025
| export default { | ||
| plugins: { | ||
| unocss: plugin, | ||
| '@unocss': plugin, |
Member
There was a problem hiding this comment.
This is a unrelated change and it's also a breaking change
Contributor
Author
There was a problem hiding this comment.
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 #4999
1f92f78 to
6791208
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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