module.exports = (api) => {
  api.cache(true);
  return {
    sourceType: 'module',
    presets: [
      [
        '@babel/preset-env',
        {
          useBuiltIns: 'usage',
          corejs: 3,
        }
      ],
      [
        '@babel/preset-react',
        {
          development: process.env.NODE_ENV === 'development',
        }
      ]
    ],
    plugins: [
      '@babel/plugin-proposal-optional-chaining',
      [
        '@babel/plugin-proposal-decorators',
        {
          legacy: true
        }
      ],
      '@babel/plugin-proposal-function-sent',
      '@babel/plugin-proposal-export-namespace-from',
      '@babel/plugin-proposal-numeric-separator',
      '@babel/plugin-proposal-throw-expressions',
      // Stage 3
      '@babel/plugin-syntax-dynamic-import',
      '@babel/plugin-syntax-import-meta',
      [
        '@babel/plugin-proposal-class-properties',
        {
          loose: true
        }
      ],
      '@babel/plugin-proposal-json-strings',
      [
        'module-resolver', {
        root: [
          './src'
        ],
        alias: {
          '@slice': './src/slice',
          '@util': './src/util',
          '@container': './src/container',
          '@style': './src/style',
          '@constant': './src/constant',
          '@context': './src/context',
          '@components': './src/components',
          '@hook': './src/hook',
          '@actions': './src/actions',
          '@assets': './assets',
        }
      }]
    ],
  };
}
