{"id":14814,"library":"pkgroll","title":"pkgroll: Zero-Config Rollup Bundler","description":"pkgroll is a robust JavaScript package bundler built on Rollup, designed for zero-configuration builds by leveraging existing `package.json` fields like `main`, `module`, `types`, and `exports`. It streamlines the process of transforming TypeScript/ESM source code into various output formats, including ESM, CommonJS, and TypeScript declaration files (`.d.ts`). Currently stable at version 2.27.0, pkgroll maintains a frequent release cadence, with multiple bug fixes and minor feature additions observed monthly. Its key differentiators include automatic dependency externalization, built-in minification, comprehensive TypeScript support with `.d.ts` bundling, watch mode for development, and intelligent CLI output features such as hashbang insertion for executables. It simplifies package publishing by reducing the need for extensive build configurations.","status":"active","version":"2.27.0","language":"javascript","source_language":"en","source_url":"https://github.com/privatenumber/pkgroll","tags":["javascript","zero config","rollup","package.json","exports","esm","cjs","commonjs","typescript"],"install":[{"cmd":"npm install pkgroll","lang":"bash","label":"npm"},{"cmd":"yarn add pkgroll","lang":"bash","label":"yarn"},{"cmd":"pnpm add pkgroll","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for TypeScript compilation and declaration file generation.","package":"typescript","optional":false}],"imports":[],"quickstart":{"code":"{\n    \"name\": \"my-package\",\n    \"version\": \"1.0.0\",\n    \"type\": \"module\",\n    \"main\": \"./dist/index.cjs\",\n    \"module\": \"./dist/index.mjs\",\n    \"types\": \"./dist/index.d.ts\",\n    \"exports\": {\n        \".\": {\n            \"require\": {\n                \"types\": \"./dist/index.d.cts\",\n                \"default\": \"./dist/index.cjs\"\n            },\n            \"import\": {\n                \"types\": \"./dist/index.d.mts\",\n                \"default\": \"./dist/index.mjs\"\n            }\n        },\n        \"./foo\": {\n            \"import\": \"./dist/foo.mjs\",\n            \"require\": \"./dist/foo.cjs\"\n        }\n    },\n    \"scripts\": {\n        \"build\": \"pkgroll\"\n    },\n    \"devDependencies\": {\n        \"pkgroll\": \"^2.0.0\",\n        \"typescript\": \"^5.0.0\"\n    }\n}\n// To run the build:\nnpm install\nnpm run build","lang":"json","description":"This quickstart demonstrates how to configure `package.json` for `pkgroll` to define entry points and output formats, then run the build."},"warnings":[{"fix":"Install a compatible TypeScript version: `npm install --save-dev typescript@\"^5.0\"` or `npm install --save-dev typescript@\"^4.1\"` as required by your pkgroll version.","message":"pkgroll has a peer dependency on TypeScript. Ensure you install a compatible version (e.g., `^4.1` or `^5.0`). While v2.27.0 supports TypeScript 6, older versions of pkgroll or incompatible TypeScript installations can lead to build failures.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Place source files corresponding to `dist` outputs in a `src` directory (e.g., `src/index.ts` for `dist/index.cjs`), or use `pkgroll --srcdist 'my-src:my-dist'` to define custom mappings.","message":"pkgroll automatically maps output paths defined in `package.json` (e.g., `./dist/index.cjs`) to source files (e.g., `./src/index.ts`). Ensure your source file structure aligns with these inferred mappings, or use the `--srcdist` flag for custom source/distribution directory mappings.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Always specify a file extension in wildcard export patterns: `\"./utils/*\": \"./dist/utils/*.mjs\"`.","message":"When using wildcard patterns in `package.json#exports` (e.g., `./utils/*`), it is critical to include a file extension in the pattern (e.g., `./dist/utils/*.mjs`). Failing to do so will result in an error as pkgroll requires explicit file extensions for wildcard resolution.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consult Node.js documentation on `package.json#exports` and ensure all required conditions (`import`, `require`, `types`) are correctly specified for each entry point to support all target environments.","message":"pkgroll relies heavily on `package.json` `exports` field for defining entry points and output formats. Incorrect or incomplete configuration of `exports`, especially regarding `import` and `require` conditions, can lead to incorrect bundling or runtime issues in consumers.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.27.0':59 'addit':73 'automat':80 'bug':68 'build':22,118 'built':14,84 'built-in':83 'bundl':92 'bundler':6,13 'cadenc':65 'cjs':127 'cli':99 'code':42 'commonj':49,128 'comprehens':87 'config':4,122 'configur':21,119 'current':55 'd.ts':54,91 'declar':52 'depend':81 'design':17 'develop':96 'differenti':78 'esm':48,126 'execut':107 'exist':25 'export':33,125 'extens':117 'extern':82 'featur':72,101 'field':27 'file':53 'fix':69 'format':46 'frequent':63 'hashbang':104 'includ':47,79 'insert':105 'intellig':98 'javascript':11,120 'key':77 'leverag':24 'like':28 'main':29 'maintain':61 'minif':86 'minor':71 'mode':94 'modul':30 'month':75 'multipl':67 'need':115 'observ':74 'output':45,100 'packag':12,110 'package.json':26,124 'pkgroll':1,7,60 'process':37 'publish':111 'reduc':113 'releas':64 'robust':10 'rollup':5,16,123 'simplifi':109 'sourc':41 'stabl':56 'streamlin':35 'support':89 'transform':39 'type':31 'typescript':51,88,129 'typescript/esm':40 'various':44 'version':58 'watch':93 'zero':3,20,121 'zero-config':2 'zero-configur':19","created_at":"2026-04-20T18:43:44.873261+00:00","updated_at":"2026-04-20T18:43:44.873261+00:00","problems":[{"fix":"Install TypeScript: `npm install --save-dev typescript` or `pnpm add -D typescript`.","cause":"The `typescript` peer dependency is not installed in the project.","error":"Error: Cannot find module 'typescript'"},{"fix":"Modify the `exports` entry to include a file extension, for example: `\"./utils/*\": \"./dist/utils/*.mjs\"`.","cause":"A wildcard pattern in `package.json#exports` is missing a file extension.","error":"Error: Wildcard pattern must include a file extension (e.g. `*.mjs`)"},{"fix":"Update Node.js to a version that fully supports `package.json#exports` (Node.js 14.13+ for most features, 16+ for full stable support). Review `package.json` for syntax errors.","cause":"Using advanced `package.json#exports` features (like nested conditions or specific `types` exports) with an older Node.js version that doesn't support them, or a malformed `package.json` structure.","error":"Error: Unknown export field 'exports.require.types'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"pkgroll","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/privatenumber/pkgroll","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/pkgroll","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-04-19","next_check":"2026-07-18","install_tag":null}}