An esbuild plugin for compressing output files with gzip or brotli after bundling. Current version 1.0.1, released in 2023 with infrequent updates. It supports filtering by file type and optional deletion of originals. Differentiators include a simple API, TypeScript types, and compatibility with esbuild >=0.17.19. Compared to alternatives like esbuild-plugin-compress or manual post-build scripts, this plugin is lightweight and straightforward.
npm install esbuild-plugin-compressorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Bundles a TypeScript entry point and compresses output JS and CSS files using brotli.
Always specify fileTypes with at least one extension, e.g., ['js', 'css'].
Verify that esbuild's output matches the plugin's expectations (same directory or specified outdir).
Use extensions with leading dot in fileTypes, e.g., ['js'] not ['js'] but note that examples show ['js', 'css'] without dot, but the plugin internally adds dot if missing? Check source; safer to include dot. Actually from README: fileTypes: ['js', 'css'] works. The error occurs if no output files have those extensions.