babel.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2023 Girish M
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. const config = {
  17. presets: [
  18. ['@babel/preset-env', {
  19. targets: {
  20. chrome: 66,
  21. firefox: 60,
  22. edge: 42,
  23. safari: 12,
  24. },
  25. modules: false,
  26. corejs: 3,
  27. debug: false,
  28. useBuiltIns: 'usage',
  29. shippedProposals: true,
  30. }],
  31. ['@babel/preset-react', {
  32. useBuiltIns: true,
  33. }],
  34. ['@babel/typescript', {
  35. allExtensions: true,
  36. isTSX: true,
  37. }],
  38. ['@emotion/babel-preset-css-prop'],
  39. ],
  40. plugins: [
  41. '@babel/plugin-proposal-class-properties',
  42. '@babel/plugin-syntax-dynamic-import',
  43. '@babel/proposal-object-rest-spread',
  44. '@babel/plugin-proposal-optional-chaining',
  45. 'babel-plugin-typescript-to-proptypes',
  46. ],
  47. };
  48. // Jest needs module transformation
  49. config.env = {
  50. test: {
  51. presets: config.presets,
  52. plugins: config.plugins,
  53. },
  54. };
  55. config.env.test.presets[0][1].modules = 'auto';
  56. module.exports = config;