-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(es/typescript): Handle shebang with jsx pragma #8318
fix(es/typescript): Handle shebang with jsx pragma #8318
Conversation
.span | ||
.with_lo(n.body.first().map(|s| s.span_lo()).unwrap_or(n.span.lo)), | ||
false => n.span, | ||
}; |
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.
FWIW, I think probably a better solution would be to consolidate the jsx prag detection code, but I believe the jsx prag detection code in swc_ecma_transforms_react is doing too much work as it checks every module item instead of just the top of the file:
swc/crates/swc_ecma_transforms_react/src/jsx/mod.rs
Lines 1033 to 1040 in 5fa2ed4
self.parse_directives(module.span); | |
for item in &module.body { | |
let span = item.span(); | |
if self.parse_directives(span) { | |
break; | |
} | |
} |
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.
It's due to mdxjs
A potential fix to CI issues: actions/setup-node#899 (comment) |
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.
Thanks!
swc-bump:
- swc_ecma_transforms_typescript
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.
Automated review comment generated by auto-rebase script
Description:
This handles a shebang with a jsx prag. Previously
h
would be removed as an import in this case.Related issue: