babel.config.js 540 B

1234567891011121314151617181920212223242526272829
  1. module.exports = api => {
  2. const isESMBuild = api.env("esm");
  3. const presets = [
  4. ["@babel/env", {
  5. debug: true,
  6. loose: true,
  7. }],
  8. "@babel/flow",
  9. ];
  10. if (isESMBuild) {
  11. presets[0][1].targets = {
  12. esmodules: true,
  13. };
  14. }
  15. const plugins = [
  16. "@babel/transform-runtime",
  17. ["@babel/proposal-class-properties", {
  18. loose: true,
  19. }],
  20. "version-inline",
  21. ];
  22. return {
  23. presets,
  24. plugins,
  25. };
  26. };