Babel ES2015 Rollup Preset

3.0.0 · abandoned · verified Wed Apr 22

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.

Common errors

Warnings

Install

Imports

Quickstart

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)}`);

view raw JSON →