babel.config.js 918 B

1234567891011121314151617181920212223242526272829
  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-transform-runtime',
  11. // NOTE: The order of the decorator and class-property plugins is important
  12. // here. Decorators must be processed first before class properties, see:
  13. // https://babeljs.io/docs/en/plugins#plugin-ordering
  14. ['@babel/plugin-proposal-decorators', {legacy: true}],
  15. ['@babel/plugin-proposal-class-properties', {loose: true}],
  16. ],
  17. env: {
  18. production: {},
  19. development: {
  20. plugins: [
  21. ['emotion', {sourceMap: true, autoLabel: true}],
  22. '@babel/plugin-transform-react-jsx-source',
  23. ],
  24. },
  25. test: {
  26. plugins: [['emotion', {autoLabel: true}], 'dynamic-import-node'],
  27. },
  28. },
  29. };