-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Use automatic react runtime for v18.0.0 #6948
Conversation
|
It seems to be a bit wrong. The problem is I test with RunKit. console.log(semver.satisfies('18.0.0', '>= 17.0.0')); // true
console.log(semver.satisfies('18.0.0-alpha-a8cabb564-20210915', '>= 17.0.0')); // false BTW, I suggest to use coercion of semver to compare versions including prelease libraries. console.log(semver.valid(semver.coerce('18.0.0-alpha-a8cabb564-20210915'))); // "18.0.0"
console.log(semver.satisfies(semver.valid(semver.coerce('18.0.0-alpha-a8cabb564-20210915')), '>= 17.0.0')); // true |
@mtgto, I do agree |
This looks like a cleaner solution: require("semver").satisfies("18.0.0-rc.0-next-13036bfbc-20220121", ">= 17.0.0", {includePrerelease: true})
===
true @alexeyraspopov Could you fix that? |
The approach doesn’t seem ideal because it won’t work for |
We don't really want to do a path resolution for every single asset to determine this. I think it's safe to assume that using an experimental React version means that it's a recent one which supports the automatic runtime (and if not, these very few projects could still use the manualy jsconfig setting). So the check should be something like |
Fair. |
(I don't understand this part but your approach sounds good to me too.) |
Opened a new PR to implement the above suggestion: #7642 |
↪️ Pull Request
When using
react@next
andreact-dom@next
, NPM installsv18.0.0-alpha-XXXXXXX
. Parcel uses>= 17.0.0
to determine whether to use automatic runtime or React.createElement. The check fails for v18.x probably because of semver:>=17.0.0
does not go beyond the major release.🚨 Test instructions
Using a fresh nightly build
parcel@^2.0.0-nightly.838
withreact@^18.0.0-alpha-a8cabb564-20210915
(and similarreact-dom
, or simplyreact@next
), writing any JSX withoutimport React from 'react'
throws an errorReact is not defined
in browser.✔️ PR Todo