Sha256: c64cf427d6ec0f85745fe42b2bbe8ee93332ab9d1593c485228de9358b43638d
Contents?: true
Size: 1.7 KB
Versions: 7
Compression:
Stored size: 1.7 KB
Contents
module.exports = 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 variables. Valid values are "development", ' + '"test", and "production". Instead, received: '}${JSON.stringify( currentEnv )}.` ); } return { presets: [ isTestEnv && [ '@babel/preset-env', { modules: 'commonjs', targets: { node: 'current' } } ], (isProductionEnv || isDevelopmentEnv) && [ '@babel/preset-env', { forceAllTransforms: true, useBuiltIns: 'entry', modules: false, exclude: ['transform-typeof-symbol'] } ], '@babel/preset-react' ].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, regenerator: true } ], [ '@babel/plugin-transform-regenerator', { async: false } ] ].filter(Boolean) }; };
Version data entries
7 entries across 7 versions & 1 rubygems