babel.config.js 717 B

1234567891011121314151617181920212223242526
  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. include: [
  10. '@babel/plugin-proposal-nullish-coalescing-operator',
  11. '@babel/plugin-proposal-optional-chaining',
  12. '@babel/plugin-proposal-numeric-separator',
  13. ],
  14. loose: true,
  15. targets,
  16. useBuiltIns: false, // Don't add polyfills automatically.
  17. modules: false,
  18. }],
  19. ],
  20. plugins: [
  21. ['@babel/plugin-transform-react-jsx', { pragma: 'h', pragmaFrag: 'Fragment' }],
  22. process.env.NODE_ENV !== 'dev' && 'babel-plugin-inline-package-json',
  23. ].filter(Boolean),
  24. }
  25. }