babel.config.js 628 B

12345678910111213141516171819202122
  1. module.exports = (api) => {
  2. const targets = {}
  3. if (api.env('test')) {
  4. targets.node = 'current'
  5. }
  6. return {
  7. presets: [
  8. ['@babel/preset-env', {
  9. loose: true,
  10. targets,
  11. useBuiltIns: false, // Don't add polyfills automatically.
  12. // We can uncomment the following line if we start adding polyfills to the non-legacy dist files.
  13. // corejs: { version: '3.15', proposals: true },
  14. }],
  15. ],
  16. plugins: [
  17. ['@babel/plugin-transform-react-jsx', { pragma: 'h' }],
  18. process.env.IS_RELEASE_BUILD && 'babel-plugin-inline-package-json',
  19. ].filter(Boolean),
  20. }
  21. }