question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for the experimental syntax 'jsx' isn't currently enabled

See original GitHub issue

Bug Report

  • I would like to work on a fix!

Current behavior

Add @babel/plugin-transform-react-jsx (https://git.io/vb4yd) to the ‘plugins’ section of your Babel config to enable transformation.

Input Code import my own local npm package into a create-react-app project

const MyComponent = () => {
  return (
    <div>
      <button type="button">Click me</button>
      <p>Hello</p>
    </div>
  )
}

Expected behavior expect to work successfully!!

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: package.json
{
  ...,
  "devDependencies": {
    "@babel/core": "^7.11.4",
    "@babel/plugin-transform-react-jsx": "^7.10.4",
    "@babel/plugin-transform-react-jsx-self": "^7.10.4",
    "@babel/preset-env": "^7.11.0",
    "@babel/preset-react": "^7.10.4",
    "babel-loader": "^8.1.0",
    "css-loader": "^4.2.2",
    "reactstrap": "^8.5.1",
    "style-loader": "^1.2.1",
    "webpack": "^4.44.1",
    "webpack-cli": "^3.3.12"
  },
  "babel": {
    "presets": [
      "@babel/preset-react",
      "@babel/preset-env"
    ],
    "plugins": [
      "@babel/plugin-transform-react-jsx"
    ]
  }
}

Environment

  System:
    OS: macOS 10.15.6
  Binaries:
    Node: 14.5.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.7 - /usr/local/bin/npm
  npmPackages:
    @babel/core: ^7.11.4 => 7.11.4 
    @babel/plugin-transform-react-jsx: ^7.10.4 => 7.10.4 
    @babel/plugin-transform-react-jsx-self: ^7.10.4 => 7.10.4 
    @babel/preset-env: ^7.11.0 => 7.11.0 
    @babel/preset-react: ^7.10.4 => 7.10.4 
    babel-loader: ^8.1.0 => 8.1.0 
    webpack: ^4.44.1 => 4.44.1 

  • Babel version(s): [6.18.0 (babel-core 6.18.2)]
  • Node/npm version: [Node 14.5.0/npm 6.14.7]
  • OS: [macOS Catalina 10.15.6]
  • Monorepo: [no]
  • How you are using Babel: [package.json, using .babelrc still not working]

Possible Solution

Additional context Add any other context about the problem here. Or a screenshot if applicable 截屏2020-08-28 下午3 01 29

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zhyd1997commented, Aug 29, 2020

fixed, thank you @JLHwung

0reactions
JLHwungcommented, Sep 18, 2020

@007tom I don’t see new replies here. I can lock this thread if you see spam comments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for the experimental syntax 'jsx' isn't currently enabled
Just create a .babelrc file in the root of your project and add: { "presets": ["@babel/preset-env", "@babel/preset-react"] }.
Read more >
Support for the experimental syntax 'jsx' isn't currently enabled ...
Support for the experimental syntax 'jsx' isn't currently enabled after creating a TypeScript react project and installing an NPM package with ...
Read more >
Jest error parsing React jsx files “Support for the experimental ...
Jest error parsing React jsx files “Support for the experimental syntax 'jsx' isn't currently enabled”. I ran into this error adding new Jest ......
Read more >
Support for the experimental syntax 'jsx' isn't currently enabled
JavaScript : Support for the experimental syntax ' jsx ' isn't currently enabled [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >
Babel Config Error: Support for the experimental syntax 'jsx ...
Coding example for the question Babel Config Error: Support for the experimental syntax 'jsx' isn't currently enabled-Reactjs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found