Sha256: 4b9d18c1deca9adb1e3f7b5a7cdc59ffba6bee06878e4656c4f0b2a3d86cdb92

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

Stored size: 1.63 KB

Contents

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

  if (!validEnv.includes(currentEnv)) {
    throw new Error(
      'Please specify a valid `NODE_ENV` or ' +
        '`BABEL_ENV` environment variables. 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',
        {
          forceAllTransforms: true,
          useBuiltIns: 'entry',
          corejs: 3,
          modules: false,
          exclude: ['transform-typeof-symbol']
        }
      ]
    ].filter(Boolean),
    plugins: [
      'babel-plugin-macros',
      '@babel/plugin-syntax-dynamic-import',
      isTestEnv && 'babel-plugin-dynamic-import-node',
      '@babel/plugin-transform-destructuring',
      [
        '@babel/plugin-proposal-class-properties',
        {
          loose: true
        }
      ],
      [
        '@babel/plugin-proposal-object-rest-spread',
        {
          useBuiltIns: true
        }
      ],
      [
        '@babel/plugin-transform-runtime',
        {
          helpers: false
        }
      ],
      [
        '@babel/plugin-transform-regenerator',
        {
          async: false
        }
      ]
    ].filter(Boolean)
  }
}

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
policy_decision_point-0.1.0 example/babel.config.js
webpacker-5.4.0 lib/install/config/babel.config.js
webpacker-5.3.0 lib/install/config/babel.config.js
webpacker-5.2.2 lib/install/config/babel.config.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/babel.config.js
ruby2js-4.0.4 lib/tasks/testrails/babel.config.js
ruby2js-4.0.3 lib/tasks/testrails/babel.config.js
jetpacker-0.5.0 lib/install/config/babel.config.js
webpacker-5.2.1 lib/install/config/babel.config.js
webpacker-5.2.0 lib/install/config/babel.config.js