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

feat(es/react): Support script in automatic runtime #7126

Merged
merged 2 commits into from Mar 27, 2023

Conversation

JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Mar 22, 2023

Description:

Inject const { jsx: _jsx} = require("react/jsx-runtime") when sourceType is script

Related issue:

@JSerFeng JSerFeng force-pushed the fix/react-require-runtime branch 4 times, most recently from bb8e97a to 145d357 Compare March 23, 2023 05:32
@JSerFeng JSerFeng requested a review from kdy1 March 23, 2023 05:43
@JSerFeng JSerFeng changed the title fix(react): 🐛 import undefined jsx-runtime with script source type fix(react): 🐛 inject jsx-runtime with script source type Mar 23, 2023
@JSerFeng JSerFeng changed the title fix(react): 🐛 inject jsx-runtime with script source type fix(react): 🐛 require jsx-runtime with script source type Mar 23, 2023
init: Some(Box::new(Expr::Call(CallExpr {
span: DUMMY_SP,
callee: Callee::Expr(Box::new(Expr::Ident(Ident {
span: DUMMY_SP,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have SyntaxContext with unresolve_mark as the only Mark

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done

@JSerFeng JSerFeng requested a review from kdy1 March 23, 2023 12:59
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll merge this along with other breaking changes.


swc-bump:

  • swc_ecma_transforms_react --breaking

@kdy1 kdy1 changed the title fix(react): 🐛 require jsx-runtime with script source type feat(es/react): Support scripts in automatic mode (#7126) Mar 27, 2023
@kdy1 kdy1 changed the title feat(es/react): Support scripts in automatic mode (#7126) feat(es/react): Support scripts within automatic runtime (#7126) Mar 27, 2023
@kdy1 kdy1 changed the title feat(es/react): Support scripts within automatic runtime (#7126) feat(es/react): Support scripts within automatic runtime Mar 27, 2023
@kdy1 kdy1 changed the title feat(es/react): Support scripts within automatic runtime feat(es/react): Support script in automatic runtime Mar 27, 2023
@kdy1 kdy1 enabled auto-merge (squash) March 27, 2023 05:11
@kdy1 kdy1 added this to the Planned milestone Mar 27, 2023
Copy link
Collaborator

@swc-bot swc-bot left a 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

@kdy1 kdy1 merged commit 05a2815 into swc-project:main Mar 27, 2023
128 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.3.43, v1.3.44 Mar 29, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Should require jsx runtime in Script
3 participants