babel-preset-blueflag

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript

A Babel preset encapsulating Blue Flag's opinionated configuration for transpiling JavaScript. Version 1.0.1, seems to be a single release. It automatically uses babel-preset-env to target either the last 2 browser versions or current Node.js, and includes plugins for runtime, class properties, stage-3, and React. Configuration options allow disabling specific plugins/presets and passing custom options to child presets. No updates since initial release, likely stable/small user base.

error Error: Plugin/Preset files are not allowed to export objects, only functions.
cause Using an outdated Babel version that expects function presets.
fix
Upgrade to Babel 7+ or ensure preset is loaded correctly.
error Module not found: Error: Can't resolve 'babel-preset-env'
cause babel-preset-env is not installed as a direct dependency when using npm v7+ with auto-peer-deps off.
fix
Run npm install babel-preset-env --save-dev.
deprecated babel-preset-stage-3 is deprecated in Babel 7+
fix Replace with individual plugins or @babel/preset-env with proposals.
gotcha Option 'library' currently does nothing
fix Ignore or remove 'library' configuration until implemented.
gotcha Disabled array requires plugin/preset names without prefix
fix Use 'react', not 'babel-preset-react'.
npm install babel-preset-blueflag
yarn add babel-preset-blueflag
pnpm add babel-preset-blueflag

Shows how to install and configure babel-preset-blueflag with browser targeting, disabled array, and custom env targets.

// Install: npm install --save babel-preset-blueflag
// In .babelrc or babel.config.js:
module.exports = {
  presets: [
    ['blueflag', {
      browser: process.env.BROWSER === 'true',
      disabled: [],
      config: {
        env: {
          targets: {
            browsers: '> 1%'
          }
        }
      }
    }]
  ]
};