getBabelConfig.js 956 B

12345678910111213141516171819202122232425262728293031323334353637
  1. module.exports = ({ isESM }) => {
  2. return {
  3. presets: [
  4. '@babel/preset-react',
  5. [
  6. '@babel/preset-env',
  7. {
  8. modules: isESM ? false : 'commonjs',
  9. targets: {
  10. browsers: [
  11. "> 0.5%",
  12. "last 2 versions",
  13. "Firefox ESR",
  14. "not dead",
  15. "not IE 11"
  16. ]
  17. }
  18. },
  19. ],
  20. ],
  21. plugins: [
  22. 'lodash',
  23. [
  24. '@babel/plugin-transform-runtime',
  25. {
  26. corejs: 3
  27. },
  28. ],
  29. [
  30. '@babel/plugin-proposal-decorators',
  31. {
  32. legacy: true,
  33. },
  34. ],
  35. ]
  36. };
  37. };