babel.config.js 975 B

12345678910111213141516171819202122232425262728
  1. /*eslint-env node*/
  2. module.exports = {
  3. presets: ['@babel/react', '@babel/env'],
  4. plugins: [
  5. 'emotion',
  6. 'lodash',
  7. 'react-hot-loader/babel',
  8. '@babel/plugin-syntax-dynamic-import',
  9. '@babel/plugin-proposal-object-rest-spread',
  10. '@babel/plugin-proposal-optional-chaining',
  11. '@babel/plugin-transform-runtime',
  12. // NOTE: The order of the decorator and class-property plugins is important
  13. // here. Decorators must be processed first before class properties, see:
  14. // https://babeljs.io/docs/en/plugins#plugin-ordering
  15. ['@babel/plugin-proposal-decorators', {legacy: true}],
  16. ['@babel/plugin-proposal-class-properties', {loose: true}],
  17. ['babel-plugin-transform-builtin-extend', {globals: ['Array', 'Error']}],
  18. ],
  19. env: {
  20. production: {},
  21. development: {
  22. plugins: [['emotion', {sourceMap: true, autoLabel: true}]],
  23. },
  24. test: {
  25. plugins: [['emotion', {autoLabel: true}], 'dynamic-import-node'],
  26. },
  27. },
  28. };