roly
raw JSON → 1.1.1 verified Sat Apr 25 auth: no javascript abandoned
roly is a JavaScript bundler that acts as a wrapper around Rollup, simplifying multi-format bundle generation (CommonJS, UMD, ES modules) and minification via CLI or package.json config. Current stable version is 1.1.1, last released in 2018 with no recent updates. It differentiates from raw Rollup by allowing format-specific compression and plugin configuration through a single command, avoiding multiple config files. However, it is effectively abandonware—no commits since 2018, poor documentation, and low adoption. For production use, prefer Rollup or Vite.
Common errors
error Error: Cannot find module 'rollup' ↓
cause roly requires rollup as a peer dependency, but it may not be installed automatically.
fix
npm install rollup --save-dev
error TypeError: roly is not a function ↓
cause Trying to use roly as a CommonJS require in a Node < 14 environment, but roly is ESM-only.
fix
Use import or upgrade Node to >=14. If using CommonJS, use dynamic import: const roly = await import('roly');
error Error: Arguments in wrong order ↓
cause Passing multiple --format flags without commas and without separating them as individual flags can cause parsing issues.
fix
Use --format cjs,umd,es (comma-separated) or --format cjs --format umd --format es (multiple flags).
Warnings
deprecated roly has no commits since 2018 and is considered abandoned. Use Rollup or Vite instead. ↓
fix Migrate to Rollup (https://rollupjs.org) or Vite (https://vitejs.dev)
gotcha UMD format bundles all third-party dependencies; other formats exclude them. ↓
fix If you need external dependencies in CJS/ES, either rely on consumer bundler or use Rollup's externals option via roly's rollup config.
gotcha The 'compress' option only works with UMD format (--compress umd). Specifying other formats will silently ignore compression. ↓
fix Use --compress umd explicitly. For other formats, minify separately using tools like terser.
gotcha CLI format flags must be comma-separated (e.g., --format cjs,umd). Space-separated values will only take the first. ↓
fix Use commas: --format cjs,umd,es. Alternatively, use --format cjs --format umd --format es (individual flags).
Install
npm install roly yarn add roly pnpm add roly Imports
- roly wrong
const roly = require('roly')correctimport roly from 'roly' - CLI usage wrong
roly --entry src/main.js --format cjs umd escorrectroly src/main.js --format cjs,umd,es --compress umd - package.json config wrong
{"roly":{"entry":"src/main.js","format":"cjs"}}correct{"roly":{"entry":"src/main.js","format":["cjs","umd","es"],"compress":"umd"}}
Quickstart
// Install globally or locally
npm install -g roly
// Create a sample module
mkdir my-lib && cd my-lib
npm init -y
// Write src/index.js
// src/index.js
export default function hello() {
console.log('Hello from roly!');
}
// Build with roly: generates dist/index.common.js (CJS)
roly
// Build multiple formats with compression:
roly --format cjs,umd,es --compress umd
// Check output files:
// dist/index.common.js (CJS)
// dist/index.js (UMD)
// dist/index.min.js (compressed UMD)
// dist/index.es.js (ES modules)