babel.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  2. // See LICENSE.txt for license information.
  3. const config = {
  4. presets: [
  5. ['@babel/preset-env', {
  6. targets: {
  7. chrome: 66,
  8. firefox: 60,
  9. edge: 42,
  10. safari: 12,
  11. },
  12. modules: false,
  13. corejs: 3,
  14. debug: false,
  15. useBuiltIns: 'usage',
  16. shippedProposals: true,
  17. }],
  18. ['@babel/preset-react', {
  19. useBuiltIns: true,
  20. }],
  21. ['@babel/typescript', {
  22. allExtensions: true,
  23. isTSX: true,
  24. }],
  25. ['@emotion/babel-preset-css-prop'],
  26. ],
  27. plugins: [
  28. '@babel/plugin-proposal-class-properties',
  29. '@babel/plugin-syntax-dynamic-import',
  30. '@babel/proposal-object-rest-spread',
  31. '@babel/plugin-proposal-optional-chaining',
  32. 'babel-plugin-typescript-to-proptypes',
  33. ],
  34. };
  35. // Jest needs module transformation
  36. config.env = {
  37. test: {
  38. presets: config.presets,
  39. plugins: config.plugins,
  40. },
  41. };
  42. config.env.test.presets[0][1].modules = 'auto';
  43. module.exports = config;