babel-preset-es2015-node5
raw JSON → 1.2.0 verified Sat Apr 25 auth: no javascript deprecated
A Babel preset for Node.js 5 to add missing ES2015 features such as destructuring, rest/parameters, modules, sticky/unicode regex, function name improvements, and shorthand property fixes. Version 1.2.0 is the latest stable release. This preset is specifically intended for Node 5 and is now obsolete as Node 5 has reached end-of-life. It was designed to complement the natively supported ES2015 features in that engine. For modern Node, use @babel/preset-env instead.
Common errors
error Error: Couldn't find preset "es2015-node5" relative to directory ↓
cause Preset not installed or incorrect preset name.
fix
Run 'npm install --save-dev babel-preset-es2015-node5' and ensure .babelrc uses 'es2015-node5' (without 'babel-preset-').
error Error: Plugin 0 specified in "base" provided an invalid property of type "undefined" ↓
cause Using this preset with Babel 7 which expects different plugin format.
fix
Upgrade to @babel/preset-env and adjust configuration for Babel 7.
Warnings
deprecated Node.js 5 has reached end-of-life. This preset is no longer maintained. ↓
fix Upgrade to Node.js 12+ and use @babel/preset-env with targets: { node: 'current' }.
gotcha This preset only works with Babel 6.x, not Babel 7+. ↓
fix For Babel 7, use @babel/preset-env instead.
gotcha The preset does not include all ES2015 features; only specific missing ones for Node 5. ↓
fix If you need full ES2015 support, use babel-preset-es2015.
gotcha The package version (1.2.0) may not receive further updates. ↓
fix Pin to exact version or migrate to a modern preset.
Install
npm install babel-preset-es2015-node5 yarn add babel-preset-es2015-node5 pnpm add babel-preset-es2015-node5 Imports
- es2015-node5 (preset) wrong
In .babelrc: { "presets": ["babel-preset-es2015-node5"] }correctIn .babelrc: { "presets": ["es2015-node5"] } - require('babel-core').transform wrong
require('babel-core').transform('code', { presets: ['es2015-node5'] })correctrequire('babel-core').transform('code', { presets: ['es2015-node5'] }) - destructuring (plugin) wrong
Manually specifying individual plugins is unnecessary.correcttransform-es2015-destructuring is automatically included when using the preset.
Quickstart
// Install: npm install --save-dev babel-preset-es2015-node5
// .babelrc
{
"presets": ["es2015-node5"]
}
// Then run: babel script.js --out-file compiled.js