Load jsx-runtime after existing imports#12546
Merged
nicolo-ribaudo merged 6 commits intobabel:mainfrom Jan 10, 2021
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/36813/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f59e3ce:
|
Member
Author
|
Thanks @babel-bot 😄 I don't have a windows pc to regenerate those fixtures and your help is welcome! (ref) |
JLHwung
reviewed
Dec 22, 2020
53e2752 to
b981bc3
Compare
JLHwung
reviewed
Jan 4, 2021
f9bef2e to
c34234e
Compare
[skip ci] Co-authored-by: Brian Ng <bng412@gmail.com>
JLHwung
approved these changes
Jan 6, 2021
existentialism
approved these changes
Jan 10, 2021
This was referenced Mar 8, 2021
chore(deps-dev): bump @babel/plugin-external-helpers from 7.10.4 to 7.12.13
chantouchsek/v-timers#12
Closed
Closed
This was referenced Mar 15, 2021
Closed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
With the
classicruntime, it's easy to import polyfills needed by React: you first import the polyfill, and then React itself. However, with theautomaticruntime, thereact/jsx-runtimeimport is always injected at the top and thus it's not possible to manually control the imports order.This PR changes it so that
react/jsx-runtimeimports always come last: imports are hoisted so it's not a problem if they are injected after the actual usage. However, it's a problem with commonjs sincerequirecalls are not hoisted and not always statically analyzable: when using CJS with theautomaticruntime, you'll need to load the polyfills in an entry point that doesn't contain JSX code.This PR adds a new feature to
@babel/helper-module-imports, so we might want to release this in a minor version.cc @babel/react