babel.config.json 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {
  2. "compact": false,
  3. "presets": [
  4. [
  5. "@babel/env",
  6. {
  7. "useBuiltIns": "usage",
  8. // This version must be aligned with the `core-js` version in `package.json`
  9. "corejs": { "version": "3.46" },
  10. "exclude": [
  11. // Exclude Array.prototype.push polyfill, as it's not needed and affects performance in Chrome
  12. "es.array.push",
  13. // Exclude objectSpread polyfill, as it's not needed and affects performance
  14. "@babel/plugin-transform-object-rest-spread",
  15. // Exclude _defineProperty polyfill, as it causes a bug without the objectSpread polyfill
  16. "@babel/plugin-transform-computed-properties",
  17. // Use native async functions, for performance
  18. "@babel/plugin-transform-async-to-generator",
  19. // Use native generators, for performance
  20. "@babel/plugin-transform-regenerator",
  21. // Use native async generators, for performance
  22. "@babel/plugin-transform-async-generator-functions",
  23. // Use native for-of loops, for performance
  24. "@babel/plugin-transform-for-of"
  25. ]
  26. }
  27. ],
  28. ["@babel/react", { "runtime": "automatic" }],
  29. "@babel/typescript"
  30. ],
  31. "plugins": ["macros"],
  32. "overrides": [
  33. // treat .cjs files (e.g. libraries symlinked into node_modules) as commonjs
  34. {
  35. "test": "../../**/*.cjs",
  36. "sourceType": "script"
  37. },
  38. {
  39. "test": "../../libraries/overleaf-editor-core/**/*.js",
  40. "sourceType": "script"
  41. }
  42. ]
  43. }