{"id":17170,"library":"babel-preset-es2015-rollup","title":"Babel ES2015 Rollup Preset","description":"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.","status":"abandoned","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/rollup/babel-preset-es2015-rollup","tags":["javascript"],"install":[{"cmd":"npm install babel-preset-es2015-rollup","lang":"bash","label":"npm"},{"cmd":"yarn add babel-preset-es2015-rollup","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-preset-es2015-rollup","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This preset builds upon and modifies the original babel-preset-es2015.","package":"babel-preset-es2015","optional":false},{"reason":"This plugin is explicitly included by the preset to externalize Babel helper functions for Rollup bundling efficiency.","package":"babel-plugin-external-helpers","optional":false},{"reason":"This preset is designed to be used in conjunction with rollup-plugin-babel within a Rollup build configuration.","package":"rollup-plugin-babel","optional":false},{"reason":"As a Babel preset, it requires a compatible version of Babel's core compiler (or @babel/core for Babel 7+).","package":"babel-core","optional":false}],"imports":[{"note":"Babel presets are configured via .babelrc or babel.config.js, not imported directly into JavaScript code.","wrong":"import es2015Rollup from 'babel-preset-es2015-rollup';","symbol":"Preset in .babelrc","correct":"{ \"presets\": [\"es2015-rollup\"] }"},{"note":"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.","wrong":"import es2015Rollup from 'babel-preset-es2015-rollup';\n// ...\nbabel({ presets: [es2015Rollup] })","symbol":"Preset in Rollup config (via rollup-plugin-babel)","correct":"import babel from 'rollup-plugin-babel';\n// ... in plugins array\nbabel({ presets: ['es2015-rollup'] })"}],"quickstart":{"code":"/* package.json */\n{\n  \"name\": \"my-rollup-project\",\n  \"version\": \"1.0.0\",\n  \"devDependencies\": {\n    \"rollup\": \"^0.60.0\",\n    \"rollup-plugin-babel\": \"^2.7.1\",\n    \"babel-cli\": \"^6.26.0\",\n    \"babel-core\": \"^6.26.3\",\n    \"babel-preset-es2015\": \"^6.24.1\",\n    \"babel-plugin-external-helpers\": \"^6.22.0\",\n    \"babel-preset-es2015-rollup\": \"^3.0.0\"\n  }\n}\n\n/* .babelrc */\n{\n  \"presets\": [\"es2015-rollup\"]\n}\n\n/* rollup.config.js */\nimport babel from 'rollup-plugin-babel';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'es'\n  },\n  plugins: [\n    babel({\n      exclude: 'node_modules/**',\n      // This tells rollup-plugin-babel to use the .babelrc configuration\n      // For older versions, babelrc: true might be needed explicitly\n      // For modern setups, prefer babelHelpers: 'bundled' or 'runtime' and @babel/preset-env\n    })\n  ]\n};\n\n/* src/main.js */\nexport const greet = (name) => `Hello, ${name}!`;\nexport const add = (a, b) => a + b;\n\nconsole.log(greet('World'));\nconsole.log(`The sum is ${add(5, 3)}`);\n","lang":"javascript","description":"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."},"warnings":[{"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`.","message":"The 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.","severity":"breaking","affected_versions":">=3.0.0"},{"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`.","message":"This 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.","severity":"breaking","affected_versions":">=3.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=3.0.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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`).","cause":"The package or one of its peer dependencies (like `babel-core` or `babel-preset-es2015`) is not installed or not resolvable by Babel.","error":"Cannot find module 'babel-preset-es2015-rollup'"},{"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`.","cause":"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.","error":"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."},{"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.","cause":"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.","error":"SyntaxError: Unexpected token import/export"}],"ecosystem":"npm","meta_description":null}