TsMinifier is a TypeScript minifier that provides identifier mangling and whitespace removal, targeting TypeScript source files directly. Version 4.1.0-dev.1 is a development release. It differs from general minifiers by operating on TypeScript syntax rather than transpiled JavaScript, and it integrates as a transform plugin for the ts2js compiler. The package ships TypeScript type definitions. It has a small focus compared to full-featured minifiers like Terser, but offers simplicity for TypeScript-specific minification.
npm install tsminifierNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the minify function to minify a TypeScript file with identifier mangling and whitespace removal.
Update calls to pass an options object as the second argument: minify(code, { mangleIdentifiers: true })Use the new plugin system via '@toddthomson/ts2js-transform-minify' instead.
Set mangleIdentifiers: false or use a reserved property list.
Ensure your import path references 'tsminifier' not 'tsminifier/index.js'.
Use a separate TypeScript compiler (e.g., tsc) after minification if you need JavaScript output.
Upgrade Node.js to version 14 or above as per current requirements.
Use named import: import { minify } from 'tsminifier'Run: npm install tsminifier@latest
Transpile to ES2015+ first or avoid using unsupported syntax.
Set mangleIdentifiers: false or increase the mangling scope.