Repository: mui/material-ui
File: docs/babel.config.js (JavaScript)

Code before:
  '@material-ui/lab': '../packages/material-ui-lab/src',
  '@material-ui/styles': '../packages/material-ui-styles/src',
  '@material-ui/styled-engine-sc': '../packages/material-ui-styled-engine-sc/src',
  // Swap the comments on the next two lines for using the styled-components as style engine
  '@material-ui/styled-engine': '../packages/material-ui-styled-engine/src',
  // '@material-ui/styled-engine': '../packages/material-ui-styled-engine-sc/src',
  '@material-ui/system': '../packages/material-ui-system/src',
  '@material-ui/private-theming': '../packages/material-ui-private-theming/src',
  '@material-ui/utils': '../packages/material-ui-utils/src',
  '@material-ui/unstyled': '../packages/material-ui-unstyled/src',
  docs: './',
  modules: '../modules',
  pages: './pages',
};

const { version: transformRuntimeVersion } = fse.readJSONSync(
  require.resolve('@babel/runtime-corejs2/package.json'),
);

module.exports = {
  presets: [
    // backport of https://github.com/zeit/next.js/pull/9511
    ['next/babel', { 'transform-runtime': { corejs: 2, version: transformRuntimeVersion } }],
  ],
  plugins: [
    [
      'babel-plugin-macros',
      {
        muiError: {
          errorCodesPath,
        },
      },
    ],
    'babel-plugin-optimize-clsx',
    // for IE11 support
    '@babel/plugin-transform-object-assign',
    [
      'babel-plugin-module-resolver',
      {
        alias,
        transformFunctions: ['require', 'require.context'],
        resolvePath,
      },
    ],
  ],
  ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue.
  env: {
    production: {
      plugins: [
        '@babel/plugin-transform-react-constant-elements',
        ['babel-plugin-react-remove-properties', { properties: ['data-mui-test'] }],

Review comment (suggestion):
`next` only uses `automatic` in `react@^17.0.0-rc.1` but disregards the new JSX runtime in React 16 and 15 as well as the other release channels.

We're forcing it in our root config as well so you can look at this as a consistency change as well.

Code after:
  '@material-ui/lab': '../packages/material-ui-lab/src',
  '@material-ui/styles': '../packages/material-ui-styles/src',
  '@material-ui/styled-engine-sc': '../packages/material-ui-styled-engine-sc/src',
  // Swap the comments on the next two lines for using the styled-components as style engine
  '@material-ui/styled-engine': '../packages/material-ui-styled-engine/src',
  // '@material-ui/styled-engine': '../packages/material-ui-styled-engine-sc/src',
  '@material-ui/system': '../packages/material-ui-system/src',
  '@material-ui/private-theming': '../packages/material-ui-private-theming/src',
  '@material-ui/utils': '../packages/material-ui-utils/src',
  '@material-ui/unstyled': '../packages/material-ui-unstyled/src',
  docs: './',
  modules: '../modules',
  pages: './pages',
};

const { version: transformRuntimeVersion } = fse.readJSONSync(
  require.resolve('@babel/runtime-corejs2/package.json'),
);

module.exports = {
  presets: [
    // backport of https://github.com/zeit/next.js/pull/9511
    [
      'next/babel',
      {
        'preset-react': { runtime: 'automatic' },
        'transform-runtime': { corejs: 2, version: transformRuntimeVersion },
      },
    ],
  ],
  plugins: [
    [
      'babel-plugin-macros',
      {
        muiError: {
          errorCodesPath,
        },
      },
    ],
    'babel-plugin-optimize-clsx',
    // for IE11 support
    '@babel/plugin-transform-object-assign',
    [
      'babel-plugin-module-resolver',
      {
        alias,
        transformFunctions: ['require', 'require.context'],
        resolvePath,
      },
    ],
  ],