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: transpiling React.createElement into Preact h behavior #7435
Merged
devongovett
merged 14 commits into
parcel-bundler:v2
from
Shinyaigeek:fix/correct-jsx-runtime-import-source
Dec 19, 2021
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6081742
Feature: detect reactLib with pkg.alias.react
Shinyaigeek ca600b4
Chore: add test for preact aliasing
Shinyaigeek 2be5e56
Merge branch 'v2' into fix/correct-jsx-runtime-import-source
Shinyaigeek 09b9844
Chore: fix h -> React.createElement in Preact compat alias
Shinyaigeek e470610
Feature: convert alias into pragma in jsx-runtime transformation
Shinyaigeek cd066b1
Merge branch 'fix/correct-jsx-runtime-import-source' of https://githu…
Shinyaigeek ad8a85a
Merge branch 'v2' into fix/correct-jsx-runtime-import-source
Shinyaigeek db5d8dd
Fix: access pkg.alias with nullish coalescing
Shinyaigeek 3aedb45
Update: add preact-compat to alias
Shinyaigeek e05804a
Update: prepare effectiveReactLib variable to set react pragma lib na…
Shinyaigeek ce3e884
Merge branch 'v2' into fix/correct-jsx-runtime-import-source
Shinyaigeek f35daf2
Merge branch 'v2' into fix/correct-jsx-runtime-import-source
Shinyaigeek 4efec78
Chore: add jsx-transform with alias testing to check correctly import…
Shinyaigeek 31fedf2
Merge branch 'fix/correct-jsx-runtime-import-source' of https://githu…
Shinyaigeek File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/jsx-automatic-preact-with-alias/index.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = <div />; |
Empty file.
3 changes: 3 additions & 0 deletions
3
...n-tests/test/integration/jsx-automatic-preact-with-alias/node_modules/preact/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...ages/core/integration-tests/test/integration/jsx-automatic-preact-with-alias/package.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"preact": "^10.5" | ||
}, | ||
"alias": { | ||
"react": "preact/compat", | ||
"react-dom/test-utils": "preact/test-utils", | ||
"react-dom": "preact/compat", | ||
"react/jsx-runtime": "preact/jsx-runtime" | ||
} | ||
} |
Empty file.
This file contains 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
This file contains 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
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.
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 think we should also add this to make sure it's actually importing from React (using a Regex because
react/jsx-runtime
is a substring ofpreact/jsx-runtime
).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.
Sure. I fixed in 4efec78 👍 Thanks!