js-shrink is a supplemental JavaScript minifier that shortens string literals, property names, variable names, and built-in values by replacing frequently used strings with short variable declarations. It preserves property names (no mangling) for safety, making it less effective than full mangling but safe for all property names. This package is typically used alongside a standard minifier like Terser for additional size reduction. It is released on npm under MIT license and receives occasional updates. Key differentiators: focuses on string and property name shortening without mangling, supports source maps, and allows fine-grained control through many options.
npm install js-shrinkNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of js-shrink to minify a simple function by shortening literals and variable names.
Set 'all: true' to shrink everything except numbers, classObjects, and functions, or explicitly enable desired features.
Understand that property names are replaced with short variables (not renamed) – they remain the same but are assigned to shorter identifiers.
Check latest docs for any alternative; currently still supported.
Enable both options to get an inline source map.
Use import shrink from 'js-shrink' (ESM) or const shrink = require('js-shrink') (CJS).Add type:module to package.json or use require('js-shrink') instead.Run npm install js-shrink, then check node_modules directory.
No dependency data recorded yet.