babel.config.js 785 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. module.exports = function(api) {
  2. api.cache(true);
  3. const presets = [
  4. [
  5. '@babel/preset-env',
  6. {
  7. targets: {
  8. node: 'current',
  9. },
  10. },
  11. ],
  12. '@babel/preset-react',
  13. ];
  14. const plugins = [
  15. 'lodash',
  16. // transform
  17. // from `import { Button } from 'reactstrap';`
  18. // to `import Row from 'reactstrap/Button';`
  19. [
  20. 'transform-imports', {
  21. reactstrap: {
  22. // eslint-disable-next-line no-template-curly-in-string
  23. transform: 'reactstrap/es/${member}',
  24. preventFullImport: true,
  25. },
  26. },
  27. ],
  28. '@babel/plugin-proposal-optional-chaining',
  29. [
  30. '@babel/plugin-proposal-class-properties', { loose: true },
  31. ],
  32. ];
  33. return {
  34. presets,
  35. plugins,
  36. };
  37. };