{"id":22129,"library":"rollup-plugin-minify-html-literals-v3","title":"rollup-plugin-minify-html-literals-v3","description":"Rollup plugin to minify HTML template literal strings, forked from the official rollup-plugin-minify-html-literals to support Rollup v3 and later (including Rollup v4). Version 1.3.4 ships TypeScript types and works as a drop-in replacement. The plugin minifies tagged template literals (e.g., lit-html, html`...`, css`...`), with fine-grained include/exclude filters. It wraps the minify-html-literals library and offers full options passthrough. Compared to the original, this fork updates the Rollup peer dependency range; no code changes beyond that. Official repo is still on Rollup v2, so this fork remains active until upstream is updated.","status":"active","version":"1.3.4","language":"javascript","source_language":"en","source_url":"https://github.com/ouweiya/rollup-plugin-minify-html-literals-v3","tags":["javascript","rollup-plugin","minify","html","literal","literals","template","tagged","lit-html","typescript"],"install":[{"cmd":"npm install rollup-plugin-minify-html-literals-v3","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-minify-html-literals-v3","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-minify-html-literals-v3","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin API","package":"rollup","optional":false},{"reason":"core minification logic","package":"minify-html-literals","optional":false}],"imports":[{"note":"The plugin is exported as default, not a named export.","wrong":"import { minifyLiterals } from 'rollup-plugin-minify-html-literals-v3'","symbol":"default","correct":"import minifyLiterals from 'rollup-plugin-minify-html-literals-v3'"},{"note":"Package is ESM-only. Cannot be used with require().","wrong":"const minifyLiterals = require('rollup-plugin-minify-html-literals-v3')","symbol":"minifyLiterals","correct":"import minifyLiterals from 'rollup-plugin-minify-html-literals-v3'"},{"note":"If you must use CommonJS, use dynamic import and access .default.","wrong":"const minifyLiterals = require('rollup-plugin-minify-html-literals-v3')","symbol":"minifyLiterals (CommonJS workaround)","correct":"const minifyLiterals = (await import('rollup-plugin-minify-html-literals-v3')).default"}],"quickstart":{"code":"// rollup.config.js\nimport minifyLiterals from 'rollup-plugin-minify-html-literals-v3';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    minifyLiterals({\n      include: 'src/**/*.js',\n      options: {\n        minifyOptions: {\n          caseSensitive: true,\n          collapseWhitespace: true\n        }\n      }\n    })\n  ]\n};","lang":"javascript","description":"Basic rollup.config.js using default import of the plugin with include filter and custom minify options."},"warnings":[{"fix":"Ensure you have the correct package name: rollup-plugin-minify-html-literals-v3","message":"This package is a fork; do not confuse with the original rollup-plugin-minify-html-literals","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use import syntax or dynamic import with .default as shown in imports.","message":"The plugin is ESM-only. Using require() will throw an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If using Rollup v4, ensure rollup-plugin-minify-html-literals-v3 is at version 1.3.0 or higher.","message":"Rollup v3 support is being phased out; this package works with Rollup v4 but may require updating peer dependencies.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Review default minify options and override if needed – especially keepClosingSlash and collapseBooleanAttributes.","message":"The options.minifyOptions are passed directly to html-minifier; some defaults may over-minify (e.g., removing quotes, unsafe for attributes).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set include: '**/*.js' or a more specific minimatch pattern to avoid unexpectedly processing non-JS files.","message":"Including or excluding files: default include is all files; if you only want to minify certain extensions, set include explicitly.","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":"Change to import syntax: import minifyLiterals from 'rollup-plugin-minify-html-literals-v3'","cause":"Using require() on this ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Remove curly braces: import minifyLiterals from 'rollup-plugin-minify-html-literals-v3'","cause":"Named import instead of default import: import { minifyLiterals } from ...","error":"TypeError: minifyLiterals is not a function"},{"fix":"Rename file to rollup.config.js (not .cjs) and use import syntax, or use dynamic import.","cause":"Rollup config file using CommonJS require inside an ESM context.","error":"The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten"},{"fix":"Install minify-html-literals: npm install minify-html-literals","cause":"Missing dependency, or incorrect import path.","error":"Could not resolve 'minify-html-literals'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}