vite-plugin-simple-html

raw JSON →
1.1.0 verified Mon Apr 27 auth: no javascript

A Vite plugin for HTML processing and minification, currently at version 1.1.0 (stable). It supports Vite 2.3 through 8.x. Key differentiator: uses `@swc/html` (since v0.2.0) for faster, more aggressive minification compared to alternatives like `html-minifier-terser`. Ships TypeScript types and is released via OIDC trusted publishing with immutable releases. Active development, frequent releases aligned with Vite major versions.

error Error: 'vitePluginSimpleHtml' is not defined
cause Missing import or incorrect import statement
fix
Add import: import vitePluginSimpleHtml from 'vite-plugin-simple-html';
error TypeError: vitePluginSimpleHtml is not a function
cause Possible CommonJS require without default export
fix
Use ESM import instead of require.
error Error: [vite] RollupError: Could not resolve 'vite-plugin-simple-html'
cause Package not installed or not in node_modules
fix
Run npm install vite-plugin-simple-html.
breaking In v0.2.0, replaced `html-minifier-terser` with `@swc/html`. Default minification options may produce different output.
fix Review the new default options and adjust configuration in `minify` option accordingly.
breaking Peer dependency range changed from `>=2.3.0 <9.0.0` to support Vite 8; earlier versions <1.1.0 may not support Vite 8.
fix Upgrade to v1.1.0 or later to use Vite 8.
deprecated The `html-minifier-terser`-based options are no longer supported after v0.2.0. Old configuration using `html-minifier-terser` options will be ignored.
fix Migrate to `@swc/html` minification options.
npm install vite-plugin-simple-html
yarn add vite-plugin-simple-html
pnpm add vite-plugin-simple-html

Demonstrates how to import and configure the plugin with custom minification options in a Vite config file.

import vitePluginSimpleHtml from 'vite-plugin-simple-html';

export default {
  plugins: [
    vitePluginSimpleHtml({
      minify: {
        collapseWhitespace: true,
        removeComments: true,
      },
    }),
  ],
};