unstale

npm / html-minifier-next

html-minifier-next

What changed in html-minifier-next 8 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-24.

4 breaking2 new APIs and options5 performance1 behavior and defaults3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.6 on npm

html-minifier-next 98 changes

Breaking changes 2

  • JSON minification now only removes whitespace between tokens and shortens string escapes, preserving large and out-of-range numbers, negative zero, and duplicate keys.

    9.0.0release notes

  • JSON is no longer minified by default or by the conservative preset; enable minifyJSON or use the comprehensive preset.

    9.0.0release notes

New APIs and options 1

  • Adds an option to minify JSON script types, including application/ld+json, importmap, and speculationrules; it is included by the comprehensive preset.

    9.0.0release notes

Performance 5

  • When engine is swc, minifyJS now also uses SWC to minify event handler attributes instead of always using Terser, improving performance.

    9.0.1release notes

  • Improved removeUnusedCSS performance.

    9.0.1release notes

  • Improved sortAttributes performance.

    9.0.1release notes

  • Improved sortClassNames performance.

    9.0.1release notes

  • Improves the performance of collapseAttributeWhitespace.

    9.0.0release notes

html-minifier-next 87 changes

Breaking changes 2

  • CRLF and CR line breaks are written as line feeds, except in markup within htmlmin:ignore and custom fragments with whitespace padding them.

    8.11.0release notes

  • Removes namespace declarations HTML reads anyway, including on inline SVG and html; this also applies after SVGO under minifySVG.

    8.11.0release notes

New APIs and options 1

  • Writes empty SVG and MathML elements as self-closing; the comprehensive preset includes this option.

    8.11.0release notes

Behavior and default changes 1

Fixes and other changes 3

  • Carriage return references are decoded without introducing raw carriage returns that HTML reads as line feeds, preserving text in pre elements and attribute values.

    8.11.0release notes

  • SVG using xlink: attributes without an XLink namespace declaration is no longer left unminified or made to fail when continueOnMinifyError is false.

    8.11.0release notes

  • Handles SVG default values while preserving presentation attributes that inherit and gradients, patterns, and filters that refer to another.

    8.11.0release notes