babel.config.js 575 B

1234567891011121314151617181920212223242526
  1. function isBabelLoader(caller) {
  2. return caller && caller.name === "babel-loader"
  3. }
  4. module.exports = function (api) {
  5. if (api.env("test") && !api.caller(isBabelLoader)) {
  6. return {
  7. plugins: [
  8. "@babel/plugin-proposal-class-properties",
  9. "@babel/plugin-proposal-nullish-coalescing-operator",
  10. "@babel/plugin-proposal-optional-chaining",
  11. ],
  12. presets: [
  13. [
  14. "@babel/preset-env",
  15. {
  16. targets: {
  17. node: "current",
  18. },
  19. },
  20. ],
  21. ],
  22. }
  23. }
  24. return {}
  25. }