buildo Babel Preset
raw JSON → 0.1.1 verified Sat Apr 25 auth: no javascript
A Babel preset that groups plugins and presets commonly used at buildo, including support for React and Node environments. Version 0.1.1 appears to be stable with no active development. It wraps babel-preset-env and conditionally includes React plugins based on the 'env' option. Compared to other presets like babel-preset-react-app, it is minimal and organization-specific, not recommended for general use.
Common errors
error Error: Cannot find module 'babel-preset-env' ↓
cause Missing peer dependency babel-preset-env.
fix
npm install --save-dev babel-preset-env
error Error: Plugin/Preset files are not allowed to export objects, only functions. ↓
cause Using Babel 7+ which expects module formats that export functions, but babel-preset-buildo may export an object.
fix
Use Babel 6 or migrate to @babel/preset-env.
error ReferenceError: regeneratorRuntime is not defined ↓
cause Using async/generator functions without including babel-polyfill or @babel/polyfill.
fix
Add 'useBuiltIns': 'usage' option or import '@babel/polyfill'.
Warnings
deprecated Depends on babel-preset-env which has been superseded by @babel/preset-env since Babel 7. ↓
fix Use @babel/preset-env directly or migrate to Babel 7+.
gotcha The package does not specify exact peer dependencies in older versions; install may fail without manually installing babel-preset-env. ↓
fix Ensure babel-preset-env is installed: npm install --save-dev babel-preset-env
gotcha The env option is case-sensitive; 'react' and 'node' are the only supported values. Unknown values may silently default to 'node'. ↓
fix Use exactly 'react' or 'node' for the env option.
deprecated The transform-class-properties and transform-object-rest-spread plugins are included by default but are now part of @babel/preset-env's shipped proposals. ↓
fix Use @babel/preset-env with appropriate corejs version instead.
Install
npm install babel-preset-buildo yarn add babel-preset-buildo pnpm add babel-preset-buildo Imports
- default wrong
require('babel-preset-buildo') in babel.config.jscorrectIn .babelrc: { "presets": ["buildo"] } - with options wrong
{ "presets": ["buildo", { "env": "react" }] }correct{ "presets": [["buildo", { "env": "react" }]] } - environment detection wrong
Setting env option in preset options while also using BABEL_ENV/react-preset separatelycorrectSet BABEL_ENV or NODE_ENV to 'react' to automatically use react preset
Quickstart
// Install
npm install --save-dev babel-preset-buildo
// .babelrc
{
"presets": [
["buildo", {
"env": "react",
"targets": {
"chrome": 52,
"node": 4
}
}]
]
}
// Run Babel
npx babel src --out-dir lib