{"id":22305,"library":"rollup-presets","title":"rollup-presets","description":"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.","status":"active","version":"0.0.27","language":"javascript","source_language":"en","source_url":"https://github.com/builder-group/community","tags":["javascript","typescript"],"install":[{"cmd":"npm install rollup-presets","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-presets","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-presets","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only, no CommonJS export. Also note that named imports are the only way; there is no default export.","wrong":"const { libraryPreset } = require('rollup-presets')","symbol":"libraryPreset","correct":"import { libraryPreset } from 'rollup-presets'"},{"note":"If using TypeScript, you can import the options type directly for config completion.","wrong":"","symbol":"preset (type)","correct":"import { type PresetOptions } from 'rollup-presets'"},{"note":"Namespace import works, but only named exports (e.g., libraryPreset) are exposed.","wrong":"const rollupPresets = require('rollup-presets')","symbol":"Full import","correct":"import * as rollupPresets from 'rollup-presets'"}],"quickstart":{"code":"import { libraryPreset } from 'rollup-presets';\n\nexport default libraryPreset();","lang":"typescript","description":"Minimal Rollup config using libraryPreset to build a TypeScript library with ESM and CJS formats."},"warnings":[{"fix":"Add an 'exports' field or standard fields to your package.json defining the entry points (import, require, types, source).","message":"Package.json exports are required for libraryPreset to resolve bundle paths correctly; standard fields (main, module, types) are also supported but exports is recommended.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin to a specific version and test upgrades carefully. Consider using lockfiles.","message":"Version 0.x may introduce breaking changes without semver major bumps; minor versions can change API.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use dynamic import: const { libraryPreset } = await import('rollup-presets'); or set your project to ESM (type: 'module' in package.json).","message":"The package is ESM-only; CommonJS require() will throw an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set preserveModules: false to flatten output, or ensure your consuming app handles nested imports.","message":"If preserveModules is true, the output directory structure mirrors the source; this can lead to deep nested paths.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: npm install rollup-presets --save-dev. Then verify import path: 'rollup-presets' (not 'rollup/presets').","cause":"Package not installed or incorrect import path.","error":"Error: No such module 'rollup-presets'"},{"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\"}}}","cause":"Trying to use libraryPreset without a package.json that has exports or standard fields.","error":"TypeError: Cannot read properties of undefined (reading 'plugin')"},{"fix":"Change your rollup.config.js to .mjs extension or use dynamic import: const { libraryPreset } = await import('rollup-presets');","cause":"Running in a CommonJS environment while rollup-presets is ESM-only.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}