rollup-standalone
raw JSON → 0.42.9 verified Mon Apr 27 auth: no javascript deprecated
A standalone, browser-ready bundle of Rollup (v0.42.9), the JavaScript module bundler. This package provides Rollup as a single file with no external dependencies, suitable for use in browsers or environments without a module system. It wraps Rollup's API, allowing bundling without Node.js. Note that this is an older Rollup version (0.x), not compatible with modern Rollup plugins or configuration. The package is minimal with no recent updates.
Common errors
error rollup is not defined ↓
cause Trying to use a named import or require without proper bundler/ESM support.
fix
import rollup from 'rollup-standalone' // default import
error Cannot find module 'rollup' ↓
cause Mistakenly trying to import 'rollup' instead of 'rollup-standalone'.
fix
import rollup from 'rollup-standalone';
Warnings
gotcha The package wraps Rollup v0.42.9, which is very old. Modern Rollup plugins and configuration (e.g., using output.format) may not work. ↓
fix Use the official 'rollup' package instead, and ensure your configuration is compatible with Rollup 0.x.
deprecated This package is no longer maintained. Use the official 'rollup' package which offers a standalone build via unpkg or cdn. ↓
fix Switch to 'rollup' and use the official browser build from https://unpkg.com/rollup/dist/rollup.js
gotcha The default export is a function with methods; named exports do not exist. Developers may incorrectly try to import { rollup } or { watch }. ↓
fix Always use the default import: import rollup from 'rollup-standalone'
Install
npm install rollup-standalone yarn add rollup-standalone pnpm add rollup-standalone Imports
- rollup wrong
const rollup = require('rollup-standalone');correctimport rollup from 'rollup-standalone'; - rollup.watch wrong
import { watch } from 'rollup-standalone';correctimport rollup from 'rollup-standalone'; rollup.watch(options); - rollup.rollup wrong
import { rollup } from 'rollup-standalone';correctimport rollup from 'rollup-standalone'; const bundle = await rollup.rollup(inputOptions);
Quickstart
// Basic usage: bundle a module
import rollup from 'rollup-standalone';
async function bundle() {
const bundle = await rollup.rollup({ input: './src/main.js' });
const { output } = await bundle.generate({ format: 'iife', name: 'MyBundle' });
for (const chunk of output) {
console.log(chunk.code);
}
}
bundle().catch(err => console.error(err));