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 new React 17 JSX Transforms (runtime: automatic)

See original GitHub issue

React 17 has a new JSX Transform that Next.js 10 has default support for. Other projects, like Emotion 11 also have support.

I don’t believe mdx-js does yet, when I try to build with a .babelrc like:

{
  "presets": [
    [
      "next/babel",
      {
        "preset-react": {
          "runtime": "automatic",
          "importSource": "@emotion/react"
        }
      }
    ]
  ],
  "plugins": ["@emotion/babel-plugin"]
}

@mdx/loader fails with importSource cannot be set when runtime is classic when building. Related StackOverflow issue.

It looks like this may be on the way in v2? I didn’t see an existing issue to track, so opening this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:19
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
wooormcommented, Oct 19, 2021

This issue, adding support for the automatic JSX runtime, is now supported. By default. In the latest RC. Please see https://v2.mdxjs.com for more info, and do let us know of anything you‘re running into or other suggestions!

1reaction
ChristianMurphycommented, Jan 19, 2021

This may become configurable as part of https://github.com/mdx-js/mdx/pull/1413

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing the New JSX Transform – React Blog
Instead of transforming JSX to React.createElement , the new JSX transform automatically imports special functions from those new entry points ...
Read more >
React 17 introduces new JSX transform - Saeloun Blog
React 17 introduces jsx-runtime and jsx-dev-runtime that enables the user to write JSX without importing React.
Read more >
React 17: New JSX Transform - JavaScript in Plain English
React 17, 16.4, 15.7, and 0.14.10 released a new feature that no longer requires importing React to transform JSX. This is a comprehensive...
Read more >
How to Use New JSX Transform IN REACT - Aspire Blogs
in React 17, The new JSX transforms imports a special function from these entry points automatically and calls them.
Read more >
babel/plugin-transform-react-jsx
Automatic runtime is a feature added in v7.9.0 . With this runtime enabled, the functions that JSX compiles to will be imported automatically....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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 Hashnode Post

No results found