rollupify
raw JSON → 0.5.1 verified Mon Apr 27 auth: no javascript deprecated
A Browserify transform that applies Rollup to convert ES6/ES2015 modules into a single CommonJS module, enabling tree-shaking and scope-hoisting for smaller bundles. The current stable version is 0.5.1. This package is unmaintained and considered a legacy hack for migrating from Browserify to Rollup; most users should instead use Rollup directly with rollup-plugin-commonjs and rollup-plugin-node-resolve. Its key differentiator is seamless integration with the Browserify pipeline, applying Rollup before other transforms like babelify. However, it only works on ES6 import/export statements, leaving require() calls untouched. Sourcemap support requires --debug flag.
Common errors
error TypeError: Cannot read property 'code' of undefined ↓
cause rollupify encountered a file it couldn't parse, possibly due to unsupported syntax like require() or non-ES6 module.
fix
Ensure all files are ES6 modules; convert require() calls to import/export.
error Error: Config file not found: rollup.config.js ↓
cause The --config path is incorrect or the file does not exist.
fix
Check that the config file path is correct relative to the current working directory.
error Bundle contains require() calls - rollupify not applied ↓
cause rollupify did not process the file; possible transform order issue or file is not an ES6 module.
fix
Ensure rollupify is listed before other transforms and that files use import/export.
Warnings
deprecated Package is marked as unmaintained and no longer actively developed. ↓
fix Migrate to a pure Rollup setup with rollup-plugin-commonjs and rollup-plugin-node-resolve.
breaking Works only on ES6 import/export statements. require() calls are left untouched. ↓
fix Convert all require() calls to import/export if you want them bundled.
gotcha When using with babelify, rollupify must be applied first. ↓
fix Specify transforms in order: rollupify then babelify.
gotcha Sourcemaps require --debug flag in Browserify. ↓
fix Pass --debug or {debug: true} to Browserify.
breaking Config must be passed as --config for CLI or as options object programmatically; not via a separate config file reference. ↓
fix Use a rollup.config.js file or pass config object directly.
Install
npm install rollupify yarn add rollupify pnpm add rollupify Imports
- default wrong
import rollupify from 'rollupify'correctconst rollupify = require('rollupify') - transform wrong
b.transform('rollupify', {})correctb.transform('rollupify', { config: { ... } }) - package.json transform wrong
"transform": ["rollupify"]correct"browserify": { "transform": ["rollupify"] }
Quickstart
// Install
npm install rollupify
// index.js
import hello from './hello';
console.log(hello);
export default hello;
// hello.js
export default "hello world";
// Command line
browserify -t rollupify index.js > output.js
// Or with custom rollup.config.js
// browserify -t [ rollupify --config rollup.config.js ] index.js > output.js