Нет описания

babel.config.js 950B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const BROWSER_COMPAT = process.env.BROWSER_COMPAT === 'true';
  2. module.exports = {
  3. presets: [
  4. [
  5. '@babel/env',
  6. {
  7. loose: true,
  8. modules: false,
  9. },
  10. ],
  11. ],
  12. plugins: [
  13. '@babel/plugin-transform-flow-strip-types',
  14. 'babel-plugin-add-import-extension',
  15. [
  16. '@babel/plugin-proposal-object-rest-spread',
  17. {
  18. loose: true,
  19. useBuiltIns: true,
  20. },
  21. ],
  22. ...(BROWSER_COMPAT
  23. ? [
  24. [
  25. 'inline-replace-variables',
  26. {
  27. __DEV__: false,
  28. },
  29. ],
  30. ]
  31. : ['dev-expression']),
  32. 'annotate-pure-calls',
  33. ],
  34. env: {
  35. test: {
  36. presets: ['@babel/env'],
  37. plugins: ['@babel/plugin-transform-runtime'],
  38. },
  39. dev: {
  40. plugins: [
  41. [
  42. 'transform-inline-environment-variables',
  43. {
  44. include: ['NODE_ENV'],
  45. },
  46. ],
  47. ],
  48. },
  49. },
  50. };