Rollup

4.60.1 · active · verified Sat Apr 18

Rollup is a next-generation ES module bundler that compiles small pieces of code into larger, more complex libraries or applications. It uses the standardized ES module format, allowing for efficient tree-shaking and optimized bundles. The current stable version is 4.60.1, and it maintains an active release cadence with frequent bug fixes and minor feature additions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates using Rollup's JavaScript API to bundle an entry file (`src/main.js`) into an immediately invoked function expression (IIFE) for browser usage, including sourcemaps and common plugins for resolving Node.js modules and converting CommonJS.

import { rollup } from 'rollup';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

async function build() {
  const bundle = await rollup({
    input: 'src/main.js',
    plugins: [resolve(), commonjs()]
  });

  await bundle.write({
    file: 'dist/bundle.js',
    format: 'iife',
    name: 'myBundle',
    sourcemap: true
  });

  console.log('Bundle created successfully!');
}

build().catch(console.error);

view raw JSON →