babel.config.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import type {TransformOptions} from '@babel/core';
  2. const config: TransformOptions = {
  3. presets: [
  4. [
  5. '@babel/preset-react',
  6. {
  7. runtime: 'automatic',
  8. importSource: '@emotion/react',
  9. },
  10. ],
  11. [
  12. '@babel/preset-env',
  13. {
  14. useBuiltIns: 'usage',
  15. corejs: '3.37',
  16. },
  17. ],
  18. // TODO: Remove allowDeclareFields when we upgrade to Babel 8
  19. ['@babel/preset-typescript', {allowDeclareFields: true}],
  20. ],
  21. overrides: [],
  22. plugins: ['@emotion/babel-plugin', '@babel/plugin-transform-runtime'],
  23. env: {
  24. production: {},
  25. development: {
  26. plugins: [
  27. '@emotion/babel-plugin',
  28. ...(process.env.SENTRY_UI_HOT_RELOAD ? ['react-refresh/babel'] : []),
  29. ],
  30. },
  31. test: {
  32. sourceMaps: process.env.CI ? false : true,
  33. plugins: [
  34. // Disable emotion sourcemaps in tests
  35. // Since emotion spends lots of time parsing and inserting sourcemaps
  36. [
  37. '@emotion/babel-plugin',
  38. {
  39. sourceMap: false,
  40. },
  41. ],
  42. ],
  43. },
  44. },
  45. };
  46. export default config;