{"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,"search_vec":"'0.0.27':20 'alia':36 'applic':17 'automat':26 'boilerpl':69 'build':13,31 'built':59 'built-in':58 'collect':11 'configur':54 'current':18 'declar':33 'default':66 'differenti':52 'earli':21 'esbuild':61 'esm/cjs':30 'export':57 'extens':51 'format':29 'four':43 'four-stag':42 'frequent':23 'generat':34 'javascript':74 'librari':15 'minim':53 'multi':28 'multi-format':27 'opinion':5,65 'package.json':56 'path':35 'plugin':45 'post':49 'pre':47 'preset':3,10 'product':7 'production-readi':6 'provid':25 'raw':71 'readi':8 'reduc':68 'releas':24 'resolut':37 'rollup':2,9,72 'rollup-preset':1 'setup':73 'speed':63 'stage':22,44 'system':46 'transform':48 'tsconfig.json':39 'typescript':14,32,75 'version':19 'versus':70 'via':55","created_at":"2026-04-27T17:04:28.608645+00:00","updated_at":"2026-04-27T17:04:28.608645+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://builder.group/?utm_source=package-json","github":"https://github.com/builder-group/community","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-presets","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}