babel.config.js 669 B

1234567891011121314151617181920212223
  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: ['@babel/plugin-proposal-nullish-coalescing-operator'],
  10. loose: true,
  11. targets,
  12. useBuiltIns: false, // Don't add polyfills automatically.
  13. // We can uncomment the following line if we start adding polyfills to the non-legacy dist files.
  14. // corejs: { version: '3.15', proposals: true },
  15. }],
  16. ],
  17. plugins: [
  18. ['@babel/plugin-transform-react-jsx', { pragma: 'h' }],
  19. 'babel-plugin-inline-package-json',
  20. ].filter(Boolean),
  21. }
  22. }