Registry / devops / jts-minify

jts-minify

JSON →
library2.5.14jsnpmunverified

jts-minify v2.5.14 is a utility for minifying JavaScript and TypeScript files. It works as a CLI tool and a library, offering basic minification features like removing whitespace, comments, and optionally encoding output as base64. The package is stable with weekly downloads under 500, and has no notable alternatives in the npm ecosystem for combined JS/TS minification. Its key differentiator is the base64 encoding option, which is uncommon in minifiers.

npm install jts-minify
INSTALL
IMPORT
SIG · JTS-MINIFY
J
jts-minify
devopsjavascriptv2.5.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jtsMinify
import { jtsMinify } from 'jts-minify'
const jtsMinify = require('jts-minify')
ESM-only since v2.0; CommonJS require will fail.
minifyFile
import { minifyFile } from 'jts-minify'
import minifyFile from 'jts-minify'
This is a named export, not default.
minifyString
import { minifyString } from 'jts-minify'
import { minify } from 'jts-minify'
The function is named minifyString, not minify.

Shows how to minify strings and files, with and without base64 encoding option.

import { minifyString, minifyFile } from 'jts-minify'; // Minify a string const code = 'const x = 1; // comment'; const result = minifyString(code, { base64: false }); console.log(result); // "const x=1;" // Minify a file await minifyFile('input.js', 'output.min.js'); // With base64 encoding const encoded = minifyString(code, { base64: true }); console.log(encoded); // "Y29uc3QgeD0xOw=="
Debug
Known issues
breakingESM-only since v2.0; requires "type": "module" in package.json or .mjs extension.
fix
Switch to ES module import syntax and ensure project uses ESM.
affects: >=2.0.0
gotchaBase64 output includes a newline at the end of the encoded string, which may cause issues in some contexts.
fix
Trim the result: result.trim() or use replace(/\n$/, '').
affects: >=1.0.0
gotchaFile minification overwrites the output file without warning; there is no backup.
fix
Always specify a different output filename or manually back up the original.
affects: >=1.0.0
deprecatedThe option `minify` in options object is deprecated; use `minifyOptions` instead.
fix
Rename option to `minifyOptions`.
affects: >=2.5.0
Errors
Common errors & fixes
SyntaxError: Unexpected token 'export'
Trying to require() an ESM-only module with CommonJS require.
fix
Use import syntax or rename file to .mjs, or set "type": "module" in package.json.
TypeError: jtsMinify is not a function
Importing the module incorrectly, likely using default import for a named export.
fix
Use `import { jtsMinify } from 'jts-minify'` instead of `import jtsMinify from 'jts-minify'`.
Error: ENOENT: no such file or directory, open 'input.js'
The input file path is incorrect or the file doesn't exist.
fix
Ensure the input file path is correct and the file exists before calling minifyFile.
Upgrade
Version history
2.5.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
jts-minify — npm install jts-minify · libregistry