This answer is coming late, but it might help someone with a similar question.
You can pass your Terser options through the minifyJS property. For example:
htmlmin.minify(html, {
minifyJS: {
compress: {
arrows: false,
},
},
})
Answer from Mubaraq Wahab on Stack Overflownpm
npmjs.com › package › html-minifier-terser
html-minifier-terser - npm
Highly configurable, well-tested, JavaScript-based HTML minifier.. Latest version: 7.2.0, last published: 3 years ago. Start using html-minifier-terser in your project by running `npm i html-minifier-terser`. There are 791 other projects in the npm registry using html-minifier-terser.
» npm install html-minifier-terser
Published Apr 11, 2023
Version 7.2.0
Author Daniel Ruf
Terser
terser.org › html-minifier-terser
HTML Minifier Terser
HTMLMinifier is made by kangax, using tweaked version of HTML parser by John Resig (which, in its turn, is based on work of Erik Arvidsson).
GitHub
github.com › terser › html-minifier-terser
GitHub - terser/html-minifier-terser: actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code · GitHub
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code - terser/html-minifier-terser
Author terser
GitHub
github.com › terser › html-minifier-terser › releases
Releases · terser/html-minifier-terser
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code - Releases · terser/html-minifier-terser
Author terser
Ubuntu
manpages.ubuntu.com › manpages › noble › man1 › html-minifier-terser.1.html
Ubuntu Manpage: html-minifier-terser - JavaScript based HTML minifier
--use-short-doctype Replaces the doctype with the short (HTML5) doctype -o --output <file> Specify output file (if not specified STDOUT will be used for output) -c --config-file <file> Use config file --input-dir <dir> Specify an input directory --output-dir <dir> Specify an output directory --file-ext <text> Specify an extension to be read, ex: html -h, --help display help for command html-minifier-terser 7.2.0 November 2023
npm
npmjs.com › package › @types › html-minifier-terser
@types/html-minifier-terser - npm
This package contains type definitions for html-minifier-terser (https://github.com/terser/html-minifier-terser#readme).
» npm install @types/html-minifier-terser
Published Nov 07, 2023
Version 7.0.2
npm
npmjs.com › package › @frontendista › html-minifier-terser
@frontendista/html-minifier-terser - npm
» npm install @frontendista/html-minifier-terser
Published Jul 24, 2023
Version 0.2.2
Author Pavel Sušický
GitHub
github.com › terser › html-minifier-terser › blob › master › package.json
html-minifier-terser/package.json at master · terser/html-minifier-terser
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code - terser/html-minifier-terser
Author terser
GitHub
github.com › terser › html-minifier-terser › tree › v6.1.0
GitHub - terser/html-minifier-terser at v6.1.0
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code - GitHub - terser/html-minifier-terser at v6.1.0
Starred by 448 users
Forked by 38 users
Languages JavaScript 99.8% | TypeScript 0.2%
npm
npmjs.com › package › gulp-html-minifier-terser
gulp-html-minifier-terser - npm
Gulp plugin to minify HTML.. Latest version: 8.0.0, last published: 17 days ago. Start using gulp-html-minifier-terser in your project by running `npm i gulp-html-minifier-terser`. There are 2 other projects in the npm registry using gulp-html-minifier-terser.
» npm install gulp-html-minifier-terser
Published Feb 14, 2026
Version 8.0.0
Author Jon Schlinkert
GitHub
github.com › terser › html-minifier-terser › blob › master › README.md
html-minifier-terser/README.md at master · terser/html-minifier-terser
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code - terser/html-minifier-terser
Author terser
webpack
webpack.js.org › plugins › html-minimizer-webpack-plugin
HtmlMinimizerWebpackPlugin | webpack
html-minifier-terser - Always collapse multiple whitespaces to 1 space (never remove it entirely), but you can change it using options
Snyk
snyk.io › advisor › html-minifier-terser › functions › html-minifier-terser.minify
How to use the html-minifier-terser.minify function in html-minifier-terser | Snyk
postProcessHtml (html, assets, assetTags) { if (typeof html !== 'string') { return Promise.reject(new Error('Expected html to be a string but got ' + JSON.stringify(html))); } const htmlAfterInjection = this.options.inject ? this.injectAssetsIntoHtml(html, assets, assetTags) : html; const htmlAfterMinification = typeof this.options.minify === 'object' ? require('html-minifier-terser').minify(htmlAfterInjection, this.options.minify) : htmlAfterInjection; return Promise.resolve(htmlAfterMinification); }
CloudDefense.ai
clouddefense.ai › code › javascript › example › html-minifier-terser
Top 10 Examples of html-minifier-terser code in Javascript
this.injectAssetsIntoHtml(html, assets, assetTags) : html; const htmlAfterMinification = typeof this.options.minify === 'object' ? require('html-minifier-terser').minify(htmlAfterInjection, this.options.minify) : htmlAfterInjection; return Promise.resolve(htmlAfterMinification); }
Stack Overflow
stackoverflow.com › questions › 65755605 › html-minifier-terser-ignores-its-output-argument
node.js - html-minifier-terser ignores its output argument - Stack Overflow
The workaround is to omit using the input and output directory arguments and instead specify the output path as in --output dist/index.min.html.
UNPKG
app.unpkg.com › html-minifier-terser@7.0.0-alpha.1 › files › README.md
html-minifier-terser
... # HTMLMinifier [ is a highly **configurable**, **well-tested**, JavaScript-based HTML minifier....