summaryrefslogtreecommitdiff
path: root/babel.config.js
blob: cbffa4c143252ec0e1a85b3a9c870ef03afa1285 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = (api) => {
  // This caches the Babel config
  api.cache.using(() => process.env.NODE_ENV)
  return {
    presets: [
      '@babel/preset-env',
      // Enable development transform of React with new automatic runtime
      ['@babel/preset-react', { development: !api.env('production'), runtime: 'automatic' }]
    ],
    // Applies the react-refresh Babel plugin on non-production modes only
    ...(!api.env('production') && { plugins: ['react-refresh/babel'] })
  }
}