Registry / devops / babel-preset-es2015-node

babel-preset-es2015-node

JSON →
library6.1.1jsnpmunverified

This package, `babel-preset-es2015-node` (current version 6.1.1), is a Babel preset designed for Babel 6 projects to automatically apply only the necessary ES2015 (ES6) transformations for a given Node.js version. It inspects `process.version` at build time to determine which ES2015 features are already natively supported by the target Node.js environment (versions >=4.0.0 are supported) and avoids transpiling those, thus aiming for faster build and execution times by minimizing unnecessary transformations. It was part of the Babel 6 ecosystem, which has reached its end-of-life. It has since been largely superseded by `@babel/preset-env`, which offers more flexible and powerful target-specific transpilation across various environments, including different Node.js versions. The package itself is not actively maintained and its usage is highly discouraged for new projects or existing projects migrating to Babel 7+ or later Node.js versions.

npm install babel-preset-es2015-node
INSTALL
IMPORT
SIG · BABEL-PRESET-ES201
B
babel-preset-es2015-node
devopsjavascriptv6.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Preset in .babelrc
{ "presets": ["es2015-node"] }
{ "presets": ["@babel/preset-es2015-node"] }
This preset is loaded by its name 'es2015-node' in Babel 6 configuration files (.babelrc). Modern Babel 7+ presets use `@babel/` scoped packages.
CLI usage
babel script.js --presets es2015-node
babel script.js --presets @babel/preset-es2015-node
For command-line usage with Babel 6, the preset name is passed directly without the `@babel/` scope.
Node API usage
require("babel-core").transform("code", { presets: ["es2015-node"] });
require("@babel/core").transform("code", { presets: ["@babel/preset-es2015-node"] });
When using Babel 6's Node API, `babel-core` is required, and the preset is referenced by its simple name. For Babel 7+, `@babel/core` and scoped preset names would be used.

Demonstrates the recommended way to configure `babel-preset-es2015-node` via a `.babelrc` file, along with CLI and Node API examples for Babel 6 environments.

{ "presets": ["es2015-node"] } // To use, first install: // npm install --save-dev babel-cli babel-preset-es2015-node // Then run Babel from your terminal: // npx babel your-source-file.js --out-file your-compiled-file.js --presets es2015-node // Or, via a Node.js script using the Babel 6 API: // const babel = require('babel-core'); // const code = `const greeting = (name) => { console.log(`Hello, ${name}!`); };`; // const result = babel.transform(code, { // presets: ['es2015-node'] // }); // console.log(result.code);
Debug
Known issues
breakingThis preset is strictly compatible with Babel 6. It will not work with Babel 7 or newer versions due to breaking changes in Babel's architecture, package naming (`@babel/scope`), and preset resolution.
fix
Migrate your Babel setup to Babel 7+ and use `@babel/preset-env` with a `targets.node` configuration. For example: `{ "presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] }`
affects: >=7.0.0 (Babel)
deprecatedThe `babel-preset-es2015` preset, which this package is based on, has been deprecated in favor of `@babel/preset-env`. This also makes `babel-preset-es2015-node` effectively deprecated and abandoned.
fix
Replace `babel-preset-es2015-node` with `@babel/preset-env`. This modern preset provides superior target-specific transpilation.
affects: >=6.1.1
gotchaThe preset relies on `process.version` at build time to determine Node.js capabilities. If your build environment's Node.js version differs from your target deployment environment, you may experience incorrect transpilation (e.g., transpiling features natively supported by the deployment environment, or failing to transpile features not supported).
fix
While `babel-preset-es2015-node` is abandoned, `@babel/preset-env` allows explicit configuration of target Node.js versions (e.g., `"node": "14"`) or using a `.browserslistrc` file for consistent targeting.
affects: >=6.1.1
Errors
Common errors & fixes
Error: Cannot find preset 'es2015-node' relative to directory ...
The `babel-preset-es2015-node` package has not been installed or is not resolvable in the project's `node_modules`.
fix
Ensure the package is installed: `npm install --save-dev babel-preset-es2015-node`.
SyntaxError: Unexpected token import (or other modern syntax error)
This usually indicates that the Babel configuration is not correctly applying the necessary transformations, often because the `babel-preset-es2015-node` preset is not being used, or Babel 6 is being used with code that requires Babel 7+ transformations.
fix
Verify that `babel-preset-es2015-node` is correctly listed in your `.babelrc` or CLI options and that Babel 6 is correctly invoked. For modern projects, switch to `@babel/preset-env` for full ESNext feature support.
You gave us a main.js, but it doesn't contain a preset or plugin to use!
Babel 6 requires explicit presets or plugins to be configured; it does nothing by default. The preset is missing from the configuration.
fix
Add `"presets": ["es2015-node"]` to your `.babelrc` file or use `--presets es2015-node` in the CLI. Alternatively, if using Babel 7+, install and configure `@babel/preset-env`.
Upgrade
Version history
6.1.1latest on npm
Audit
Dependencies
babel-preset-es2015requiredThis preset internally relies on and configures plugins from `babel-preset-es2015` based on the detected Node.js version.
babel-coreoptionalRequired as a peer dependency for Babel 6 applications to enable the Babel API and transformations.
babel-clioptionalRequired as a peer dependency for Babel 6 to use Babel from the command line.
Agent activity
2 hits · last 30 days
node
2
Resources
babel-preset-es2015-node — npm install babel-preset-es2015-node · libregistry