Registry / devops / astro-html-minifier-next

astro-html-minifier-next

JSON →
library4.0.2jsnpmunverified

Astro integration using html-minifier-next to minify HTML output during build. Version 4.0.2, requires Astro ^6.0.0 and Node >=22.13.0. Unlike other Astro HTML minifiers, it offers full configurability of html-minifier-next options and uses Lightning CSS for speed. Released under MIT license.

npm install astro-html-minifier-next
INSTALL
IMPORT
SIG · ASTRO-HTML-MINIFIE
A
astro-html-minifier-next
devopsjavascriptv4.0.2
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.

htmlMinifier
✓ import htmlMinifier from 'astro-html-minifier-next'
✗ const htmlMinifier = require('astro-html-minifier-next');
Package is ESM-only; CommonJS require() will fail.
default export
✓ import htmlMinifier from 'astro-html-minifier-next'
✗ import { htmlMinifier } from 'astro-html-minifier-next'
htmlMinifier is a default export, not a named export.
InlineConfig type
✓ import type { InlineConfig } from 'astro-html-minifier-next'
✗ import InlineConfig from 'astro-html-minifier-next'
InlineConfig is a TypeScript type export, not a value.

Configures Astro to minify HTML with recommended html-minifier-next options.

import { defineConfig } from 'astro/config'; import htmlMinifier from 'astro-html-minifier-next'; export default defineConfig({ integrations: [ htmlMinifier({ collapseWhitespace: true, removeComments: true, minifyCSS: true, minifyJS: true }) ] });
Debug
Known issues
breakingAstro v6 is required; v4.x or v5.x not supported.
fix
Upgrade Astro to ^6.0.0.
affects: >=4.0.0
breakingNode.js 22.13.0 or higher required.
fix
Update Node.js to >=22.13.0.
affects: >=4.0.0
gotchaIntegration must be added to `integrations` array; placing it elsewhere will not work.
fix
Add to integrations as shown in quickstart.
affects: >=1.0.0
gotchahtml-minifier-next options are passed directly; invalid options may be ignored or cause errors.
fix
Refer to html-minifier-next documentation for valid options.
affects: >=1.0.0
Errors
Common errors & fixes
Error: The integration 'astro-html-minifier-next' is not compatible with this version of Astro.
Using Astro <6.0.0.
fix
Upgrade Astro to ^6.0.0.
TypeError: htmlMinifier is not a function
Using a named import instead of default import.
fix
Use `import htmlMinifier from 'astro-html-minifier-next'` (default import).
require() of ES Module /.../node_modules/astro-html-minifier-next/index.js not supported.
Using CommonJS require() on an ESM-only package.
fix
Switch to ESM imports (import statement) or use dynamic import().
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
astrorequiredPeer dependency; integration requires Astro v6+.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
astro-html-minifier-next — npm install astro-html-minifier-next · libregistry