2019-02-04 14:09:35 +00:00
|
|
|
module.exports = (api) => {
|
2019-02-04 16:17:20 +00:00
|
|
|
// api.cache.forever();
|
2019-02-04 14:09:35 +00:00
|
|
|
|
2019-02-04 16:17:20 +00:00
|
|
|
const presets = [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
useBuiltIns: 'entry',
|
|
|
|
loose: true,
|
|
|
|
},
|
2019-02-04 14:09:35 +00:00
|
|
|
],
|
2019-02-04 16:17:20 +00:00
|
|
|
'@babel/preset-react',
|
|
|
|
'@babel/preset-flow',
|
|
|
|
];
|
|
|
|
|
|
|
|
const plugins = [
|
|
|
|
'react-hot-loader/babel',
|
|
|
|
'@babel/plugin-transform-flow-strip-types',
|
|
|
|
'@babel/plugin-proposal-class-properties',
|
|
|
|
'@babel/plugin-proposal-object-rest-spread',
|
|
|
|
[
|
|
|
|
'@babel/plugin-transform-runtime',
|
|
|
|
{
|
|
|
|
regenerator: true,
|
|
|
|
},
|
2019-02-04 14:09:35 +00:00
|
|
|
],
|
2019-02-04 16:17:20 +00:00
|
|
|
[
|
|
|
|
'module-resolver',
|
|
|
|
{
|
|
|
|
root: [
|
|
|
|
'./src',
|
2019-02-04 14:09:35 +00:00
|
|
|
],
|
2019-02-04 16:17:20 +00:00
|
|
|
alias: {
|
|
|
|
public: [
|
|
|
|
'./public',
|
|
|
|
],
|
|
|
|
},
|
2019-02-04 14:09:35 +00:00
|
|
|
},
|
2019-02-04 16:17:20 +00:00
|
|
|
],
|
|
|
|
'babel-plugin-styled-components',
|
|
|
|
];
|
|
|
|
|
|
|
|
if (api.env('test')) {
|
|
|
|
presets.push('jest');
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
presets,
|
|
|
|
plugins,
|
2019-02-04 14:09:35 +00:00
|
|
|
};
|
|
|
|
};
|