Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #9873
Closed
Open
Issue created Oct 23, 2020 by Administrator@rootContributor

How to disable new JSX transform and use old JSX transform

Created by: mindlid

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!!

Assignee
Assign to
Time tracking