esbuild-compress is a plugin for esbuild that compresses embedded data at build time to reduce bundle size, with runtime decompression. Current stable version is 2.2.0. It supports various compression algorithms via configurable compressors, including lazy (async) decompression. Key differentiators: designed specifically for esbuild, supports both sync and async decompression, and works with multiple data formats (JSON, text, etc.). Released under MIT license.
npm install esbuild-compressNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of esbuild-compress plugin with two compressors: one for JSON files (sync) and one for text files (lazy/async).
Upgrade esbuild to version 0.17.0 or higher.
Use await when importing lazy-compressed modules: const data = await import('./file.txt') (if using dynamic imports) or access the default export and await if using static imports with lazy loader.Switch to ESM imports (import).
Run npm install esbuild-compress --save-dev
Change to 'import esbuildCompress from "esbuild-compress"'
Install iltorb if needed: npm install iltorb
Add "type": "module" to package.json or use .mjs extension.