'use strict'

const modifyBabelPreset = require('modify-babel-preset')

const mergeByEnv = require('./lib/mergeByEnv')

const modifiedReactPreset = modifyBabelPreset('babel-preset-react', {
  'babel-plugin-transform-react-jsx': {
    pragma: 'createElement'
  }
})

module.exports = mergeByEnv({
  presets: [
    [require('babel-preset-es2015'), {modules: false}],
    require('babel-preset-es2016'),
    require('babel-preset-es2017'),
    modifiedReactPreset
  ],
  plugins: [
    require('babel-plugin-transform-decorators-legacy').default,
    require('babel-plugin-transform-object-rest-spread')
  ],
  env: {
    production: {
      plugins: [
        require('babel-plugin-transform-react-constant-elements'),
        require('babel-plugin-transform-react-inline-elements'),
        require('babel-plugin-transform-react-remove-prop-types').default
      ]
    },
    test: {
      plugins: [
        require('babel-plugin-istanbul')
      ]
    },
    development: {
      plugins: [
        require('babel-plugin-tcomb').default
      ]
    }
  }
})

'use strict'

const modifyBabelPreset = require('modify-babel-preset')

const mergeByEnv = require('./lib/mergeByEnv')

const modifiedReactPreset = modifyBabelPreset('babel-preset-react', {
  'babel-plugin-transform-react-jsx': {
    pragma: 'createElement'
  }
})

module.exports = mergeByEnv({
  presets: [
    ['babel-preset-es2015', {modules: false}],
    'babel-preset-es2016',
    'babel-preset-es2017',
    modifiedReactPreset
  ],
  plugins: [
    'babel-plugin-transform-decorators-legacy',
    'babel-plugin-transform-object-rest-spread'
  ],
  env: {
    production: {
      plugins: [
        'babel-plugin-transform-react-constant-elements',
        'babel-plugin-transform-react-inline-elements',
        'babel-plugin-transform-react-remove-prop-types'
      ]
    },
    test: {
      plugins: [
        'babel-plugin-istanbul'
      ]
    },
    development: {
      plugins: [
        'babel-plugin-tcomb'
      ]
    }
  }
})

Fix native modules && use string instead of require to require plugin
Fix native modules && use string instead of require to require plugin
