pkgroll
pkgroll is a free Linux command-line JavaScript package bundler powered by Rollup.
What pkgroll is
pkgroll is a free Linux command-line JavaScript package bundler powered by Rollup. It reads package entry points from package.json properties such as main, module, types and exports, and also supports pnpm's package.yaml. By default, paths under dist map to corresponding paths under src. Builds can produce ESM, CommonJS and TypeScript declaration files, supporting Node.js maintainers serving both module formats. Dependencies, peerDependencies and optionalDependencies are externalized, while devDependencies are bundled. Rollup performs bundling, and esbuild handles TypeScript and JavaScript transformation and minification. Listed capabilities include package exports, tree shaking, source maps, watch mode and automatic CLI hashbang insertion. Aliases can come from package.json imports or tsconfig.json compilerOptions.paths. Non-JavaScript files can be imported as text or bytes; byte imports become array literals and may increase bundle size about four times. Direct .node imports are copied to dist/natives, but dynamically loaded native modules need separate handling. The --license option writes bundled devDependency licenses to LICENSE except in watch mode. TypeScript 7 needs @typescript/typescript6 for declaration bundling.
Good
- Zero-configuration package entry handling
- Produces ESM and CommonJS outputs
- Externalizes runtime dependencies
- Supports declarations, watch mode and minification
- Free Linux tool
Watch out
- Byte imports can greatly increase bundle size
- Dynamic native modules need separate handling
- License output skipped in watch mode
- TypeScript 7 needs an additional package
Who it suits
pkgroll suits Node.js package maintainers who want zero-configuration builds for ESM, CommonJS and TypeScript declarations. It is intended for projects using package metadata as build configuration.
Verdict
pkgroll provides metadata-driven bundling with Rollup and esbuild, covering common Node.js package outputs and workflows. Native-module behavior, byte-import size growth and TypeScript 7 requirements need attention.
The facts
Each one read from pkgroll's own pages, with the date it was checked.
What it does
- Aliases
- Aliases can be configured through package.json imports or tsconfig.json compilerOptions.paths.checked 9 Oct 2026
- Binary size note
- The README says binary files imported as bytes are inlined as array literals, increasing bundle size by about four times.checked 8 Oct 2026
- Build engine
- pkgroll uses Rollup for bundling and esbuild for TypeScript and JavaScript transformation and minification.checked 8 Oct 2026
- Bundling engine
- Pkgroll uses Rollup for bundling and esbuild for TypeScript and JavaScript transformation and minification.checked 9 Oct 2026
- Configuration
- The README says no configuration is necessary and documents options including target, tsconfig path, source maps, and filtering package.json entry points.checked 9 Oct 2026
- Core features
- Listed features include package.json exports entry points, dependency externalization, minification, TypeScript and declaration bundling, watch mode, and CLI hashbang insertion.checked 8 Oct 2026
- Dependency handling
- Dependencies in dependencies, peerDependencies, and optionalDependencies are externalized, while devDependencies are bundled.checked 8 Oct 2026
- Entry points
- It reads package entry points from package.json properties including main, module, types, and exports.checked 9 Oct 2026
- Features
- Listed features include dependency externalization, minification, TypeScript support with declaration bundling, watch mode, and CLI outputs with automatic hashbang insertion.checked 9 Oct 2026
- Import attributes
- It supports importing non-JavaScript file contents as text or bytes at build time, with bytes imports inlined into the bundle.checked 8 Oct 2026
- Install
- The README gives `npm install --save-dev pkgroll` as the installation command.checked 8 Oct 2026
- Intended users
- The README describes pkgroll as a bundler for Node.js package maintainers who want to publish ESM and CommonJS outputs.checked 9 Oct 2026
- License extraction
- The --license option collects license information for bundled devDependencies and writes it to a LICENSE file.checked 9 Oct 2026
- License output
- The --license option collects license information from bundled devDependencies and writes it to a LICENSE file; it is skipped in watch mode.checked 8 Oct 2026
- Native module limit
- Native addon handling applies to direct .node imports; packages that load native modules dynamically through bindings or node-pre-gyp need separate handling.checked 8 Oct 2026
- Native modules
- Directly imported .node files are copied to dist/natives, while packages that dynamically load native modules via bindings or node-pre-gyp require separate handling.checked 9 Oct 2026
- Outputs
- It produces ESM, CommonJS, and TypeScript declaration outputs.checked 9 Oct 2026
- Package manager support
- In addition to package.json, pkgroll supports pnpm's package.yaml.checked 9 Oct 2026
- Package metadata
- It also supports pnpm's package.yaml in addition to package.json.checked 8 Oct 2026
- Purpose
- pkgroll is a zero-config JavaScript package bundler powered by Rollup that builds from entry points defined in package.json.checked 9 Oct 2026
- TypeScript 7 limit
- The README says TypeScript 7 lacks the compiler API needed for declaration bundling and instructs users to install @typescript/typescript6 alongside it for that purpose.checked 9 Oct 2026




