{"id":21892,"library":"rollup-config-pectin","title":"rollup-config-pectin","description":"A Rollup configuration preset for building tree-shakeable JavaScript libraries using conventional file patterns. Version 4.0.4 requires Node >=8.9 and Rollup >=1.12.0. It simplifies setting up Rollup with Babel and ensures proper main/module exports for ESM and CJS. Differentiators: convention over configuration, zero-config unless custom Babel preset options needed, and explicit support for tree-shaking via peer dependencies. Aimed at library authors who want a minimal Rollup setup without manual config.","status":"active","version":"4.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/evocateur/pectin","tags":["javascript","rollup","config","tree-shake","module"],"install":[{"cmd":"npm install rollup-config-pectin","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-config-pectin","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-config-pectin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin provides Rollup configuration that requires Rollup to be installed.","package":"rollup","optional":true}],"imports":[{"note":"The package exports a single default configuration object. ESM import is recommended; CommonJS require may still work but is not the primary export.","wrong":"const pectin = require('rollup-config-pectin'); module.exports = pectin;","symbol":"pectin","correct":"import pectin from 'rollup-config-pectin'; export default pectin;"}],"quickstart":{"code":"// package.json\n{\n  \"main\": \"dist/index.cjs.js\",\n  \"module\": \"dist/index.esm.js\"\n}\n\n// .babelrc (must accept options)\n{\n  \"presets\": [\n    [\"@babel/preset-env\", { \"modules\": false }]\n  ]\n}\n\n// rollup.config.js (if using programmatic API)\nimport pectin from 'rollup-config-pectin';\nexport default pectin({\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: ['cjs', 'es']\n  }\n});\n\n// Or via CLI:\n// rollup -c node:pectin -i src/index.js","lang":"javascript","description":"Shows setup: package.json with main/module, Babel config with modules:false, and using rollup-config-pectin via CLI or programmatic API."},"warnings":[{"fix":"Add 'main' and 'module' fields to package.json pointing to your output files.","message":"The package expects both 'main' and 'module' fields in package.json, otherwise output may be incomplete.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your Babel preset configuration is set appropriately (e.g., {modules: false}).","message":"If you have a .babelrc, the preset used must accept options (e.g., @babel/preset-env with modules:false), otherwise Rollup's tree-shaking may fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using the programmatic API (import default) for future-proofing.","message":"The package uses the older node:pectin preset for Rollup CLI which may become deprecated in future Rollup versions.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure 'src/index.js' exists or specify correct input path via -i flag or options.","cause":"Missing or incorrect 'input' option or no 'src/index.js' file.","error":"Error: Could not resolve entry module"},{"fix":"Rename file to 'src/index.js' or configure rollup-config-pectin with an appropriate plugin for TypeScript.","cause":"The configuration expects a JavaScript file (src/index.js) but only TypeScript files exist.","error":"(!) Plugin typescript: @rollup/plugin-typescript: Could not find source file: 'src/index.ts'"},{"fix":"Add both 'main' and 'module' fields to package.json.","cause":"The preset checks for these fields and throws if missing.","error":"Error: You must specify 'main' and 'module' in package.json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}