2022-03-12 18:24:59 +00:00
|
|
|
module.exports = function (api) {
|
|
|
|
let targets = {};
|
|
|
|
const plugins = [
|
2020-07-03 20:55:33 +00:00
|
|
|
'babel-plugin-macros',
|
|
|
|
'styled-components',
|
|
|
|
'react-hot-loader/babel',
|
|
|
|
'@babel/transform-runtime',
|
|
|
|
'@babel/transform-react-jsx',
|
|
|
|
'@babel/proposal-class-properties',
|
|
|
|
'@babel/proposal-object-rest-spread',
|
|
|
|
'@babel/proposal-optional-chaining',
|
|
|
|
'@babel/proposal-nullish-coalescing-operator',
|
|
|
|
'@babel/syntax-dynamic-import',
|
2022-03-12 18:24:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
if (api.env('test')) {
|
|
|
|
targets = { node: 'current' };
|
|
|
|
plugins.push('@babel/transform-modules-commonjs');
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
presets: [
|
|
|
|
['@babel/env', {
|
|
|
|
modules: false,
|
|
|
|
corejs: 3,
|
|
|
|
useBuiltIns: 'entry',
|
|
|
|
targets,
|
|
|
|
}],
|
|
|
|
'@babel/typescript',
|
|
|
|
'@babel/react',
|
|
|
|
],
|
|
|
|
plugins: plugins,
|
|
|
|
};
|
2020-07-03 20:55:33 +00:00
|
|
|
};
|