{"id":22689,"library":"vite-plugin-html-minifier-terser","title":"vite-plugin-html-minifier-terser","description":"Vite plugin that minifies HTML output during the build phase using html-minifier-terser. Version 3.8.0 released in 2025, maintained actively, ships TypeScript types. Configure all html-minifier-terser options directly. Differentiates from similar plugins by using the terser fork of html-minifier for better compatibility with modern HTML5. Commonly used to reduce HTML file size by removing whitespace, quotes, and comments.","status":"active","version":"3.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/tcly861204/vite-plugin-html-minifier-terser","tags":["javascript","vite","node","plugin","html-minifier-terser","typescript"],"install":[{"cmd":"npm install vite-plugin-html-minifier-terser","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-html-minifier-terser","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-html-minifier-terser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package uses a default export, not a named export.","wrong":"import { htmlMinifierTerser } from 'vite-plugin-html-minifier-terser'","symbol":"default export","correct":"import htmlMinifierTerser from 'vite-plugin-html-minifier-terser'"},{"note":"CommonJS users must access the default export via .default due to ESM interop.","wrong":"const htmlMinifierTerser = require('vite-plugin-html-minifier-terser')","symbol":"CommonJS require","correct":"const htmlMinifierTerser = require('vite-plugin-html-minifier-terser').default"},{"note":"Types are included; no separate @types package needed.","symbol":"TypeScript import","correct":"import htmlMinifierTerser from 'vite-plugin-html-minifier-terser'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport htmlMinifierTerser from 'vite-plugin-html-minifier-terser';\n\nexport default defineConfig({\n  plugins: [\n    htmlMinifierTerser({\n      removeComments: true,\n      collapseWhitespace: true,\n      removeAttributeQuotes: true,\n      minifyCSS: true,\n      minifyJS: true,\n    }),\n  ],\n});","lang":"typescript","description":"Configures vite-plugin-html-minifier-terser with common minification options in Vite's config file."},"warnings":[{"fix":"Use for production builds only; no workaround for dev.","message":"Plugin only minifies during build, not in dev mode.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check html-minifier-terser documentation for all valid options.","message":"Options are passed directly to html-minifier-terser; refer to its docs.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-plugin-html-minifier-terser --save-dev'","cause":"Package not installed or missing dependency.","error":"Error: Cannot find module 'vite-plugin-html-minifier-terser'"},{"fix":"Use 'import htmlMinifierTerser from ...' (no curly braces)","cause":"Using named import instead of default import.","error":"TypeError: htmlMinifierTerser is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}