Sha256: 2fc42eed6c4832f6ae3fe221ae437d050ba5b66afd1475e1faa4e2dede2371b2
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
module.exports = function(api) { const validEnv = ['development', 'test', 'production'] const currentEnv = process.env.NODE_ENV const isDevelopmentEnv = (currentEnv === "development") const isProductionEnv = (currentEnv === 'production') const isTestEnv = (currentEnv === '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) + '.' ) } // Cached based on the value of some function. If this function returns a value different from // a previously-encountered value, the plugins will re-evaluate. api.cache(() => 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, regenerator: true, corejs: false } ], [ '@babel/plugin-transform-regenerator', { async: false } ] ].filter(Boolean) } }
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
vite_rb-0.0.1.alpha1 | examples/rails-without-webpack/config/snowpacker/babel.config.js |
snowpacker-0.0.4.alpha1 | lib/snowpacker/templates/babel.config.js |