babel.config.js 897 B

123456789101112131415161718192021222324252627
  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. ],
  18. env: {
  19. production: {},
  20. development: {
  21. plugins: [['emotion', {sourceMap: true, autoLabel: true}]],
  22. },
  23. test: {
  24. plugins: [['emotion', {autoLabel: true}], 'dynamic-import-node'],
  25. },
  26. },
  27. };