Registry / devops / rollup-presets

rollup-presets

JSON →
library0.0.27jsnpmunverified

An opinionated, production-ready Rollup preset collection for building TypeScript libraries and applications. Current version 0.0.27 (early stage, frequent releases). Provides automatic multi-format (ESM/CJS) builds, TypeScript declaration generation, path alias resolution from tsconfig.json, and a four-stage plugin system (pre, transform, post) for extensibility. Differentiators: minimal configuration via package.json exports, built-in esbuild for speed, and opinionated defaults that reduce boilerplate versus raw Rollup setup.

npm install rollup-presets
INSTALL
IMPORT
SIG · ROLLUP-PRESETS
R
rollup-presets
devopsjavascriptv0.0.27
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

libraryPreset
import { libraryPreset } from 'rollup-presets'
const { libraryPreset } = require('rollup-presets')
Package is ESM-only, no CommonJS export. Also note that named imports are the only way; there is no default export.
preset (type)
import { type PresetOptions } from 'rollup-presets'
If using TypeScript, you can import the options type directly for config completion.
Full import
import * as rollupPresets from 'rollup-presets'
const rollupPresets = require('rollup-presets')
Namespace import works, but only named exports (e.g., libraryPreset) are exposed.

Minimal Rollup config using libraryPreset to build a TypeScript library with ESM and CJS formats.

import { libraryPreset } from 'rollup-presets'; export default libraryPreset();
Debug
Known issues
gotchaPackage.json exports are required for libraryPreset to resolve bundle paths correctly; standard fields (main, module, types) are also supported but exports is recommended.
fix
Add an 'exports' field or standard fields to your package.json defining the entry points (import, require, types, source).
affects: >=0.0.0
breakingVersion 0.x may introduce breaking changes without semver major bumps; minor versions can change API.
fix
Pin to a specific version and test upgrades carefully. Consider using lockfiles.
affects: <1.0.0
gotchaThe package is ESM-only; CommonJS require() will throw an error.
fix
Use dynamic import: const { libraryPreset } = await import('rollup-presets'); or set your project to ESM (type: 'module' in package.json).
affects: >=0.0.0
gotchaIf preserveModules is true, the output directory structure mirrors the source; this can lead to deep nested paths.
fix
Set preserveModules: false to flatten output, or ensure your consuming app handles nested imports.
affects: >=0.0.0
Errors
Common errors & fixes
Error: No such module 'rollup-presets'
Package not installed or incorrect import path.
fix
Run: npm install rollup-presets --save-dev. Then verify import path: 'rollup-presets' (not 'rollup/presets').
TypeError: Cannot read properties of undefined (reading 'plugin')
Trying to use libraryPreset without a package.json that has exports or standard fields.
fix
Ensure your package.json includes an 'exports' field like: {"exports": {".": {"import": "./dist/esm/index.js", "require": "./dist/cjs/index.js", "types": "./dist/types/index.d.ts", "source": "./src/index.ts"}}}
SyntaxError: Cannot use import statement outside a module
Running in a CommonJS environment while rollup-presets is ESM-only.
fix
Change your rollup.config.js to .mjs extension or use dynamic import: const { libraryPreset } = await import('rollup-presets');
Upgrade
Version history
0.0.27latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Bingbot
1
Resources
rollup-presets — npm install rollup-presets · libregistry