# What changed in html-minifier-next

> 15 changes in html-minifier-next 8 to 9 from its official release notes, upgrade guides and advisories: 4 breaking, 2 new APIs and options. Each one cited. Sources checked 2026-10-24. HTML: https://unstale.sh/npm/html-minifier-next/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## html-minifier-next 9

### Breaking changes

- 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.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#900---2026-10-18)
- JSON is no longer minified by default or by the conservative preset; enable minifyJSON or use the comprehensive preset. (9.0.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#900---2026-10-18)

### New APIs and options

- Adds an option to minify JSON script types, including application/ld+json, importmap, and speculationrules; it is included by the comprehensive preset. (9.0.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#900---2026-10-18)

### Performance

- When engine is swc, minifyJS now also uses SWC to minify event handler attributes instead of always using Terser, improving performance. (9.0.1) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#901---2026-10-20)
- Improved removeUnusedCSS performance. (9.0.1) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#901---2026-10-20)
- Improved sortAttributes performance. (9.0.1) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#901---2026-10-20)
- Improved sortClassNames performance. (9.0.1) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#901---2026-10-20)
- Improves the performance of collapseAttributeWhitespace. (9.0.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#900---2026-10-18)

## html-minifier-next 8

### Breaking changes

- 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.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)
- Removes namespace declarations HTML reads anyway, including on inline SVG and html; this also applies after SVGO under minifySVG. (8.11.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)

### New APIs and options

- Writes empty SVG and MathML elements as self-closing; the comprehensive preset includes this option. (8.11.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)

### Behavior and default changes

- Handles several additional default values. (8.11.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)

### Fixes and other changes

- 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.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)
- SVG using xlink: attributes without an XLink namespace declaration is no longer left unminified or made to fail when continueOnMinifyError is false. (8.11.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)
- Handles SVG default values while preserving presentation attributes that inherit and gradients, patterns, and filters that refer to another. (8.11.0) — [release notes](https://github.com/j9t/html-minifier-next/blob/66fa17215c9165020bbf63b617ace8443bee2173/CHANGELOG.md#8110---2026-10-17)
