-
Notifications
You must be signed in to change notification settings - Fork 324
fix: update to use the old JSX transform #2513
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
🦋 Changeset detectedLatest commit: 054dce2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -8,6 +8,7 @@ const iconNames = []; | |||
|
|||
const template = ({ iconName, source }) => { | |||
return `import classNames from 'classnames'; | |||
import * as React from 'react'; |
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.
The old transform will need React in scope so that why I added it in a few places
Thanks for handling this! Looks straightforward to me, but can you cherry pick the commit and test against in-app-messaging/main please? |
.changeset/rich-peas-try.md
Outdated
"@aws-amplify/ui-react": patch | ||
--- | ||
|
||
fix: update to use the old JSX transform to support app running on React prior to 16.14.0 where the nex JSX transform does not get backported |
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.
nit typo: "next JSX"
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.
ohhh, good catch I mean new
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.
LGTM! Thanks for fixing this
I test against that branch you mention in a sample app and it works good. For the build, since the old transform need React in scope, so anywhere you use JSX you will need to import React in the module and Rollup will hint you. There is only one place I can see you need to during my testing: |
@@ -4,7 +4,7 @@ | |||
"baseUrl": ".", | |||
"declaration": true, | |||
"esModuleInterop": true, | |||
"jsx": "react-jsx", |
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.
For my knowledge, can you briefly explain why this had to be changed?
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 controls how JSX constructs are emitted in JavaScript files. It has better details here <- https://www.typescriptlang.org/tsconfig#jsx
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.
TIL!
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.
LGTM 🚢
Description of changes
Update to use the old JSX transform to fix a regression.
Description of how you validated changes
Create a sample React app running on a React version prior to 16.14.0 and integrate ui-react library into the app
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.