Sha256: 2edb05c09f2dcd28411aeef7c17a2872e9f408135f6b25aa41604a76d39d346e

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

const { moduleExists } = require('shakapacker')

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,
          exclude: ['transform-typeof-symbol']
        }
      ],
      moduleExists('@babel/preset-typescript') && '@babel/preset-typescript'
    ].filter(Boolean),
    plugins: [
      ['@babel/plugin-transform-runtime', { helpers: false }]
    ].filter(Boolean)
  }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shakapacker-7.2.3 package/babel/preset.js
shakapacker-7.3.0.beta.1 package/babel/preset.js
shakapacker-7.2.2 package/babel/preset.js
shakapacker-7.2.1 package/babel/preset.js
shakapacker-7.2.0 package/babel/preset.js
shakapacker-7.2.0.rc.0 package/babel/preset.js
shakapacker-7.1.0 package/babel/preset.js
shakapacker-7.0.3 package/babel/preset.js
shakapacker-7.0.2 package/babel/preset.js
shakapacker-7.0.1 package/babel/preset.js
shakapacker-7.0.0 package/babel/preset.js
shakapacker-7.0.0.rc.2 package/babel/preset.js
shakapacker-7.0.0.rc.1 package/babel/preset.js
shakapacker-7.0.0.rc.0 package/babel/preset.js