Registry / devops / babel-preset-es2015-rollup

babel-preset-es2015-rollup

JSON →
library3.0.0jsnpmunverified

This package is a Babel preset specifically designed for use with Rollup, building upon `babel-preset-es2015`. Its primary function was to modify the standard ES2015 preset by disabling the transformation of ES module syntax to CommonJS (as Rollup handles ES modules natively) and enabling the `babel-plugin-external-helpers` to prevent helper code duplication. The latest version is 3.0.0, published nearly a decade ago. It is no longer actively maintained, and its base `babel-preset-es2015` has been deprecated since Babel v6 in favor of `@babel/preset-env`. Developers should migrate to modern Babel setups using `@babel/preset-env` with `@rollup/plugin-babel` for contemporary build workflows.

npm install babel-preset-es2015-rollup
INSTALL
IMPORT
SIG · BABEL-PRESET-ES201
B
babel-preset-es2015-rollup
devopsjavascriptv3.0.0
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-rollup"] }
import es2015Rollup from 'babel-preset-es2015-rollup';
Babel presets are configured via .babelrc or babel.config.js, not imported directly into JavaScript code.
Preset in Rollup config (via rollup-plugin-babel)
import babel from 'rollup-plugin-babel'; // ... in plugins array babel({ presets: ['es2015-rollup'] })
import es2015Rollup from 'babel-preset-es2015-rollup'; // ... babel({ presets: [es2015Rollup] })
The preset name is provided as a string to `rollup-plugin-babel`, which resolves it internally. Direct import of the preset module is not the standard approach.

Demonstrates a basic Rollup project setup using `babel-preset-es2015-rollup` via `rollup-plugin-babel` to transpile ES2015+ syntax while preserving ES modules and externalizing Babel helpers for optimal bundling.

/* package.json */ { "name": "my-rollup-project", "version": "1.0.0", "devDependencies": { "rollup": "^0.60.0", "rollup-plugin-babel": "^2.7.1", "babel-cli": "^6.26.0", "babel-core": "^6.26.3", "babel-preset-es2015": "^6.24.1", "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0" } } /* .babelrc */ { "presets": ["es2015-rollup"] } /* rollup.config.js */ import babel from 'rollup-plugin-babel'; export default { input: 'src/main.js', output: { file: 'dist/bundle.js', format: 'es' }, plugins: [ babel({ exclude: 'node_modules/**', // This tells rollup-plugin-babel to use the .babelrc configuration // For older versions, babelrc: true might be needed explicitly // For modern setups, prefer babelHelpers: 'bundled' or 'runtime' and @babel/preset-env }) ] }; /* src/main.js */ export const greet = (name) => `Hello, ${name}!`; export const add = (a, b) => a + b; console.log(greet('World')); console.log(`The sum is ${add(5, 3)}`);
Debug
Known issues
breakingThe underlying `babel-preset-es2015` and all other yearly presets (es2016, es2017) are officially deprecated by Babel. Users are strongly encouraged to migrate to `@babel/preset-env` for future-proof and configurable Babel transpilation.
fix
Replace `babel-preset-es2015-rollup` with `@babel/preset-env` in your Babel configuration. Configure `@babel/preset-env` with `modules: false` to retain ES module syntax for Rollup, and use `babelHelpers: 'bundled'` or `babelHelpers: 'runtime'` in `@rollup/plugin-babel` settings. Example: `{ presets: [['@babel/env', { modules: false }]] }` in `.babelrc`.
affects: >=3.0.0
breakingThis preset is incompatible with Babel 7 and later versions due to significant changes in Babel's architecture, package naming (e.g., `@babel/*` scoped packages), and configuration options. Attempting to use it will lead to 'module not found' or configuration errors.
fix
Upgrade your Babel installation to Babel 7+ (e.g., `@babel/core`, `@babel/preset-env`). Replace this preset with `@babel/preset-env` configured for Rollup. Ensure `rollup-plugin-babel` is also updated to `@rollup/plugin-babel`.
affects: >=3.0.0
gotchaThis preset explicitly disables ES module transformation (`modules-commonjs`) from the base `es2015` preset, relying on Rollup to handle ES modules. If you use it in environments (like Jest tests) that expect CommonJS modules, or if other Babel plugins inadvertently re-enable module transformation, it will lead to import/require errors.
fix
For testing environments like Jest, configure Babel with a different preset (e.g., `@babel/preset-env` with `modules: 'commonjs'`) or use `babel-jest` to handle module transformation. Ensure only one plugin/tool is responsible for module transformation in your build pipeline.
affects: >=3.0.0
gotchaThe preset includes `babel-plugin-external-helpers`. If you are using `@rollup/plugin-babel` with `babelHelpers: 'bundled'` or `babelHelpers: 'runtime'`, this could lead to redundant helper inclusions or conflicts.
fix
With modern `@rollup/plugin-babel` and `@babel/preset-env`, rely on the `babelHelpers` option in the Rollup plugin (e.g., `babelHelpers: 'bundled'`). Manually specifying `babel-plugin-external-helpers` in your Babel config is usually not necessary or recommended with this setup.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'babel-preset-es2015-rollup'
The package or one of its peer dependencies (like `babel-core` or `babel-preset-es2015`) is not installed or not resolvable by Babel.
fix
Ensure `babel-preset-es2015-rollup`, `babel-preset-es2015`, `babel-plugin-external-helpers`, and a compatible version of `babel-core` are installed as `devDependencies` in your project (`npm install --save-dev babel-preset-es2015-rollup babel-preset-es2015 babel-plugin-external-helpers babel-core`).
The 'typeof' Babel helper is used more than once in your code. It's strongly recommended that you use the 'external-helpers' plugin or the 'es2015-rollup' preset.
Babel is inlining helper functions multiple times, indicating that `babel-plugin-external-helpers` (which is part of this preset) is either not configured correctly or is being overridden.
fix
Ensure `babel-preset-es2015-rollup` is correctly applied in your Babel configuration. If you're using `rollup-plugin-babel`, verify that your `.babelrc` is being picked up or pass the preset explicitly. For newer Babel versions, consider using `@babel/plugin-transform-runtime` with `@babel/runtime` and the `babelHelpers: 'runtime'` option in `@rollup/plugin-babel`.
SyntaxError: Unexpected token import/export
Babel is not transforming ES module syntax, and the environment (e.g., Node.js without `--experimental-modules` or an old browser) doesn't natively support it, or a testing framework expects CommonJS. This preset intentionally disables module transformation, which can be an issue outside of Rollup's bundling process.
fix
If this error occurs in a non-Rollup context (like Jest), ensure your Babel configuration for that environment *does* transform modules to CommonJS. If it's a Rollup output issue, verify your Rollup output format is correct for your target environment (e.g., `format: 'cjs'` for Node.js or `format: 'umd'` for browsers). The preset itself prevents module transformation, which is only suitable for Rollup's ES module input.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
babel-preset-es2015requiredThis preset builds upon and modifies the original babel-preset-es2015.
babel-plugin-external-helpersrequiredThis plugin is explicitly included by the preset to externalize Babel helper functions for Rollup bundling efficiency.
rollup-plugin-babelrequiredThis preset is designed to be used in conjunction with rollup-plugin-babel within a Rollup build configuration.
babel-corerequiredAs a Babel preset, it requires a compatible version of Babel's core compiler (or @babel/core for Babel 7+).
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources