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-nodeVerified import paths — ran on the pinned version, not inferred.
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.
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" } }]] }`Replace `babel-preset-es2015-node` with `@babel/preset-env`. This modern preset provides superior target-specific transpilation.
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.
Ensure the package is installed: `npm install --save-dev babel-preset-es2015-node`.
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.
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`.