36 lines
790 B
JavaScript
36 lines
790 B
JavaScript
'use strict';
|
|
|
|
const presets = [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
modules: false,
|
|
// see also zloirock/core-js https://bit.ly/2JLnrgw
|
|
useBuiltIns: 'usage',
|
|
corejs: 3
|
|
}
|
|
],
|
|
'@babel/preset-react',
|
|
'@babel/preset-flow'
|
|
];
|
|
|
|
module.exports = api => {
|
|
api.cache.using(() => process.env.NODE_ENV);
|
|
const isDev = api.env('development');
|
|
const plugins = [
|
|
[
|
|
'@babel/plugin-transform-runtime',
|
|
{
|
|
corejs: false,
|
|
helpers: true,
|
|
regenerator: true,
|
|
useESModules: true
|
|
}
|
|
],
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
'@babel/plugin-proposal-class-properties',
|
|
'@babel/plugin-proposal-do-expressions',
|
|
isDev ? 'react-refresh/babel' : false
|
|
].filter(Boolean);
|
|
return { presets, plugins };
|
|
};
|