getBabelConfig.js 935 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. [
  23. '@babel/plugin-transform-runtime',
  24. {
  25. corejs: 3
  26. },
  27. ],
  28. [
  29. '@babel/plugin-proposal-decorators',
  30. {
  31. legacy: true,
  32. },
  33. ],
  34. ]
  35. };
  36. };