rollup-all
raw JSON → 1.10.6 verified Mon Apr 27 auth: no javascript
Rollup-all is a build tool that wraps Rollup to automatically generate CommonJS, ES module, and browser (IIFE/UMD) bundles from a single source, with built-in Babel and TypeScript support. Current stable version is 4.0.0 (August 2025), with active development and semantic versioning. It differentiates from raw Rollup by providing an opinionated, zero-config setup that handles multiple output formats, minification, asset copying, and type definition file generation without manual configuration. Notable breaking changes occurred in v3.0.0 (format configuration restructured) and v4.0.0 (defaults moved to config root). Supports Node.js 12+ and is primarily used for library development.
Common errors
error Error: Cannot find module 'rollup' ↓
cause Rollup is a peer dependency not installed.
fix
npm install --save-dev rollup
error TypeError: config is not a function ↓
cause Using default import instead of named import for 'config'.
fix
Use 'import { config } from 'rollup-all'' or 'const { config } = require('rollup-all')'.
error Error: No configuration found. Create a rollup.config.js file or use --config flag. ↓
cause Missing configuration file or incorrect file name.
fix
Ensure a rollup.config.js file exists at project root, or run rollup-all with explicit config path.
error src/index.ts(1,1): error TS2304: Cannot find name 'require'. ↓
cause Using CommonJS require in a TypeScript file without node types.
fix
Install @types/node and ensure tsconfig includes 'moduleResolution': 'node' and 'allowSyntheticDefaultImports': true.
Warnings
breaking In v4.0.0, config.defaults is removed and must be placed at config root level. ↓
fix Move any options previously under config.defaults to the root of the config object.
breaking In v3.0.0, the way build formats are enabled changed. It now uses a format-specific configuration object. ↓
fix Update your rollup.config.js to use the new format enablement structure: e.g., config({ distConfig: { enabled: true } }) instead of previous format.
gotcha The package requires certain Babel presets and plugins to be installed as peer dependencies. Missing them causes build failures. ↓
fix Install @babel/core, @babel/preset-env, @babel/preset-typescript, @babel/runtime, and @babel/plugin-transform-runtime as devDependencies.
gotcha TypeScript projects must have typescript installed as a devDependency. Rollup-all does not include it automatically. ↓
fix Ensure 'typescript' is in your devDependencies.
deprecated The 'uglify' option is deprecated in favor of 'minified'. ↓
fix Use 'minified: true' instead of 'uglify: true' in the config object.
Install
npm install rollup-all yarn add rollup-all pnpm add rollup-all Imports
- config wrong
import rollupAll from 'rollup-all'correctimport { config } from 'rollup-all' - rollupAll wrong
const rollupAll = require('rollup-all')correctimport * as rollupAll from 'rollup-all' - types (ConfigOptions) wrong
import { ConfigOptions } from 'rollup-all'correctimport type { ConfigOptions } from 'rollup-all'
Quickstart
npm install --save-dev rollup-all
// package.json
{
"scripts": {
"build": "rollup-all"
}
}
// rollup.config.js (optional)
const { config } = require('rollup-all');
module.exports = config({
config: {
sourcemap: true,
uglify: true,
assets: ['assets/**'],
distConfig: { enabled: true }
},
babelConfig: {
presets: [['@babel/preset-env', { targets: '> 0.25%' }]],
plugins: ['@babel/plugin-proposal-optional-chaining']
}
});
// Then run: npm run build