Sha256: cdb3617d12090b25f1eb2a0739a3ec2c02cf90fe4baa486a2c2d6d0b106d6b26

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module.exports = function config(api) {
  const validEnv = ['development', 'test', 'production']
  const currentEnv = api.env()
  const isDevelopmentEnv = api.env('development')
  const isProductionEnv = api.env('production')
  const isTestEnv = api.env('test')

  if (!validEnv.includes(currentEnv)) {
    throw new Error(
      `Please specify a valid NODE_ENV or BABEL_ENV environment variable. Valid values are "development", "test", and "production". Instead, received: "${JSON.stringify(currentEnv)}".`
    )
  }

  return {
    presets: [
      isTestEnv && [
        '@babel/preset-env',
        { targets: { node: 'current' } }
      ],
      (isProductionEnv || isDevelopmentEnv) && [
        '@babel/preset-env',
        {
          useBuiltIns: 'entry',
          corejs: '3.8',
          modules: 'auto',
          bugfixes: true,
          loose: true,
          exclude: ['transform-typeof-symbol']
        }
      ]
    ].filter(Boolean),
    plugins: [
      'babel-plugin-macros',
      [
        '@babel/plugin-proposal-class-properties',
        { loose: true }
      ],
      [
        '@babel/plugin-transform-runtime',
        { helpers: false }
      ]
    ].filter(Boolean)
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webpacker-6.0.0.pre.2 package/babel/preset.js
webpacker-6.0.0.pre.1 package/babel/preset.js