module.exports = api => {
  const isTest = api.env('test');

  const preset = [
    "@babel/preset-env", { targets: 'defaults' }
  ];
  const testPreset = [
    "@babel/preset-env", { targets: { node: process.versions.node } }
  ];

  const plugins = [
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-transform-react-jsx",
    "@babel/plugin-proposal-class-properties"
  ]

  return {
    "presets": [isTest ? testPreset : preset],
    "plugins": plugins
  }
}
