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-rollupVerified import paths — ran on the pinned version, not inferred.
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.
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`.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`.
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.
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.
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`).
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`.
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.