Freedom251 › JavaScript Build Tools
pkgroll

What pkgroll is
pkgroll is a free, zero-configuration 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. Dependencies, peerDependencies, and optionalDependencies are externalized, while devDependencies are bundled. Rollup handles bundling, and esbuild performs TypeScript and JavaScript transformation and minification. Listed capabilities include tree shaking, source maps, watch mode, declaration bundling, and automatic CLI hashbang insertion. Aliases can come from package.json imports or tsconfig.json paths. Non-JavaScript files can be imported as text or bytes; byte imports become array literals and can increase bundle size by about four times. Direct .node imports are copied to dist/natives.
Who it suits
pkgroll suits Node.js package maintainers shipping both ESM and CommonJS consumers. It is intended for projects that want package.json-driven builds with minimal configuration.
What it does well
- Free package bundler
- Zero-configuration package.json entries
- Outputs ESM and CommonJS
- Bundles TypeScript declarations
- Supports watch mode and tree shaking
What to know first
- Linux platform listed
- Dynamic native modules need separate handling
- Byte imports can enlarge bundles
- TypeScript 7 needs an additional package for declarations
Verdict
pkgroll provides Rollup-based package builds with TypeScript support, declaration output, and dependency handling driven by package metadata. Native-module behavior and byte-import size growth are important implementation details to review.
Facts from pkgroll's own pages
- Aliases
- Aliases can be configured through package.json imports or tsconfig.json compilerOptions.paths. · github.com, 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. · github.com, 8 Oct 2026
- Build engine
- pkgroll uses Rollup for bundling and esbuild for TypeScript and JavaScript transformation and minification. · github.com, 8 Oct 2026
- Bundling engine
- Pkgroll uses Rollup for bundling and esbuild for TypeScript and JavaScript transformation and minification. · github.com, 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. · github.com, 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. · github.com, 8 Oct 2026
- Dependency handling
- Dependencies in dependencies, peerDependencies, and optionalDependencies are externalized, while devDependencies are bundled. · github.com, 8 Oct 2026
- Entry points
- It reads package entry points from package.json properties including main, module, types, and exports. · github.com, 9 Oct 2026
- Features
- Listed features include dependency externalization, minification, TypeScript support with declaration bundling, watch mode, and CLI outputs with automatic hashbang insertion. · github.com, 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. · github.com, 8 Oct 2026
- Install
- The README gives `npm install --save-dev pkgroll` as the installation command. · github.com, 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. · github.com, 9 Oct 2026
- License extraction
- The --license option collects license information for bundled devDependencies and writes it to a LICENSE file. · github.com, 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. · github.com, 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. · github.com, 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. · github.com, 9 Oct 2026
- Outputs
- It produces ESM, CommonJS, and TypeScript declaration outputs. · github.com, 9 Oct 2026
- Package manager support
- In addition to package.json, pkgroll supports pnpm's package.yaml. · github.com, 9 Oct 2026
- Package metadata
- It also supports pnpm's package.yaml in addition to package.json. · github.com, 8 Oct 2026
- Purpose
- pkgroll is a zero-config JavaScript package bundler powered by Rollup that builds from entry points defined in package.json. · github.com, 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. · github.com, 9 Oct 2026
Where pkgroll stands on Freedom251
- JavaScript Build Tools#24 of 27