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

fix(gatsby): add runtime check for react 17 #27468

Merged
merged 1 commit into from
Oct 15, 2020

Conversation

wardpeet
Copy link
Contributor

Description

Make sure we only make it a default for react 17+. Not all libraries have moved to support automatic mode.

Related Issues

Related #26652

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 15, 2020
@wardpeet wardpeet added status: needs core review Currently awaiting review from Core team member topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Oct 15, 2020
@wardpeet
Copy link
Contributor Author

Tested with latest react.

I've added to a page

/** @jsx createElement  */
import React, { createElement } from "react"

with previous gatsby I got

gatsby-blog-starter\src\pages\index.js: pragma and pragmaFrag cannot be set when runtime is automatic.

now I don't get an error 👍

@pieh
Copy link
Contributor

pieh commented Oct 15, 2020

Also for some paper trail - this become a problem now because React@16.14 added the jsx transform ( https://github.com/facebook/react/blob/master/CHANGELOG.md#16140-october-14-2020 ) and was released yesterday and Mdx in particular doesn't seem compatible for now with it (?), causing errors like Ward described above ( https://app.circleci.com/pipelines/github/gatsbyjs/gatsby/50975/workflows/341312ae-79b4-41c2-a6d9-c31e5cae080d/jobs/526766 )

@wardpeet wardpeet merged commit 239d539 into gatsbyjs:master Oct 15, 2020
@wardpeet wardpeet deleted the revert/classic-mode branch October 15, 2020 11:44
@jquense
Copy link
Contributor

jquense commented Oct 21, 2020

ya'll this is annoying. We can't upgrade to react 17 because the ecosystem doesn't support this automatic runtime yet

@wardpeet
Copy link
Contributor Author

@jquense what's the issue? We add the automatic rule when you're using react 17

@jquense
Copy link
Contributor

jquense commented Oct 21, 2020

you still have the same errors as folks this was trying to fix. e.g. emotion, mdx, system-ui and most libraries that depend on jsx pragma do not support the automatic runtime and break even on react 17.

Basically this isn't just a matter of using react 17. Libraries have to all update to support the new jsx transform. opting everyone into a poorly supported feature isn't great

@jquense
Copy link
Contributor

jquense commented Oct 21, 2020

basically by opting everyone into this for react 17 it gates everyones ability to upgrade to react 17 to whenever all these other libraries (which do support react 17) figure out jsx automatic runtime support

@wardpeet
Copy link
Contributor Author

@jquense okay so we should disable it completely. Sounds good.

@wroughtec
Copy link

or make it a configuration so the user is able to enable to disable depending upon their needs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs core review Currently awaiting review from Core team member topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants