presetter-preset-rollup
raw JSON → 8.3.0 verified Mon Apr 27 auth: no javascript
An opinionated Presetter preset that adds professional Rollup 4 bundling to any base preset. Current stable version is 8.3.0, with monthly releases following the presetter ecosystem. Key differentiators: provides zero-configuration Rollup setup with dual CJS/ESM output, asset processing (images, CSS, JSON, YAML, GraphQL), TypeScript compilation via @rollup/plugin-typescript, bundle visualization via rollup-plugin-visualizer, and automatic path resolution via tsconfig-paths. Requires presetter 8.3.0 and node >=20.0.0. Compared to manual Rollup configuration or tools like tsdx/tsup, it integrates with the broader presetter ecosystem for linting, testing, and formatting via presetter-preset-essentials.
Common errors
error Error: Cannot find module '@rollup/plugin-commonjs' ↓
cause Missing peer dependency; not automatically installed with npm install presetter-preset-rollup
fix
npm i -D @rollup/plugin-commonjs
error Error: presetter-preset-essentials is required but not found ↓
cause Attempting to use rollup preset without the essentials base preset
fix
npm i -D presetter-preset-essentials and include it in extends array
error Error: Node.js version 18.x.x is not supported. Please upgrade to >=20.0.0 ↓
cause Node.js 18 is end-of-life and the preset enforces 20+
fix
Upgrade Node.js to version 20 or later
error TypeError: presetterPresetRollup is not a function ↓
cause Default import treated as an object instead of a function; importing incorrectly
fix
Use import rollup from 'presetter-preset-rollup' (default import), not named import
error RollupError: Could not resolve 'image.svg' from 'src/index.ts' ↓
cause Missing @rollup/plugin-image or misconfigured asset handling
fix
Ensure @rollup/plugin-image is installed and included in peer deps
Warnings
breaking Requires Node.js >= 20.0.0. Older versions will fail. ↓
fix Upgrade Node.js to 20+
breaking Peer dependencies must include @rollup/plugin-commonjs@^29, @rollup/plugin-graphql@^2, @rollup/plugin-image@^3, @rollup/plugin-json@^6, @rollup/plugin-node-resolve@^16, @rollup/plugin-typescript@^12, @rollup/plugin-yaml@^4, rollup@^4, rollup-plugin-postcss@^4, rollup-plugin-tsconfig-paths@^1, rollup-plugin-visualizer@^6, presetter@8.3.0. Missing any will cause build failures. ↓
fix Install all peer deps: npm i -D @rollup/plugin-commonjs @rollup/plugin-graphql @rollup/plugin-image @rollup/plugin-json @rollup/plugin-node-resolve @rollup/plugin-typescript @rollup/plugin-yaml rollup rollup-plugin-postcss rollup-plugin-tsconfig-paths rollup-plugin-visualizer presetter
gotcha The preset requires presetter-preset-essentials as a base; using it standalone will cause errors. ↓
fix Always extend both essentials and rollup in your presetter.config.ts
gotcha If you already have a rollup.config.js, it will be overwritten by presetter bootstrap. Back it up first. ↓
fix Backup your existing config before running npx presetter bootstrap
deprecated Use of CJS-only plugins (like rollup-plugin-analyzer) may conflict with ESM output. The preset strongly prefers ESM-first plugins. ↓
fix Replace CJS-only plugins with ESM-compatible alternatives
Install
npm install presetter-preset-rollup yarn add presetter-preset-rollup pnpm add presetter-preset-rollup Imports
- preset wrong
import preset from 'presetter'correctimport { preset } from 'presetter' - default wrong
const { rollup } = require('presetter-preset-rollup')correctimport rollup from 'presetter-preset-rollup' - presetter-preset-rollup (as a module) wrong
import 'presetter-preset-rollup'correctimport rollup from 'presetter-preset-rollup' - presetterPresetRollup (type) wrong
import type from 'presetter-preset-rollup'correctimport type { PresetConfig } from 'presetter'
Quickstart
// presetter.config.ts
import { preset } from 'presetter';
import essentials from 'presetter-preset-essentials';
import rollup from 'presetter-preset-rollup';
export default preset('my-library', {
extends: [essentials, rollup],
// Optional: override Rollup-specific settings
// Variables: {}, // see presetter-preset-rollup documentation
});
// Then run:
// npx presetter bootstrap
// npx presetter build
// npx presetter watch