How to use new automatic react runtime import with @mdx-js/loader

Viewed 1848

I am using MDX with React's new JSX Transform. My babel configuration is following:

const plugins = [
  ['@babel/plugin-proposal-nullish-coalescing-operator'],
  ['@babel/plugin-proposal-optional-chaining'],
  ['@babel/plugin-transform-react-jsx', {
    runtime: 'automatic',
    importSource: 'react'
  }]
];

However when bundling and transpiling MDX files via Webpack using @mdx-js/loader, I get following error:

importSource cannot be set when runtime is classic.

It looks like it is not picking runtime as automatic from the Babel configuration. How can I tell the loader to pick import source as mentioned in the babel config file.

0 Answers
Related