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

How to disable new JSX transform and use old JSX transform #9873

Closed
utenma opened this issue Oct 23, 2020 · 1 comment
Closed

How to disable new JSX transform and use old JSX transform #9873

utenma opened this issue Oct 23, 2020 · 1 comment

Comments

@utenma
Copy link

utenma commented Oct 23, 2020

I created a new react project, it installed the new react 17.0.1 and react scripts 4.0, now i cannot use emotion, because throws error

pragma and pragmaFrag cannot be set when runtime is automatic.
> 1 | /** @jsx jsx */

on this line

// this comment tells babel to convert jsx to calls to a function called jsx instead of React.createElement
/** @jsx jsx */
import { css, jsx } from '@emotion/core'

i know this is configured in babel so should i eject or is there a simpler way to disable just this new transform, i mean, if not it will break on projects using pragma like emotion

i mean like a USE_CLASSIC_RUNTIME boolean option on the .env file, that sets

 ["@babel/preset-react", {
      "runtime": "automatic"
    }]

to

["@babel/preset-react", {
      "runtime": "classic"
    }]

UPDATE

just ejected and seems that this options is already present

image

so just add DISABLE_NEW_JSX_TRANSFORM = true on your .env file

good luck!!

@utenma
Copy link
Author

utenma commented Oct 29, 2020

this was merged on #9861
i going to close this question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant