{"id":22060,"library":"rollup-plugin-html","title":"rollup-plugin-html","description":"A Rollup plugin that imports HTML files as JavaScript string variables. Version 0.2.1 is the latest stable release, though the project appears to be in maintenance mode with no recent updates. It uses rollup-pluginutils for file filtering and integrates with html-minifier for optional minification. Differentiators: simple API, support for include/exclude glob patterns, and opt-in HTML minification via html-minifier options. Alternatives like @rollup/plugin-html or vite-plugin-html offer more features.","status":"maintenance","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/bdadam/rollup-plugin-html","tags":["javascript","rollup","rollup-plugin","html"],"install":[{"cmd":"npm install rollup-plugin-html","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-html","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-html","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for file filtering (include/exclude patterns)","package":"rollup-pluginutils","optional":false},{"reason":"Optional HTML minification","package":"html-minifier","optional":true}],"imports":[{"note":"ESM default export. CJS require works but returns default export.","wrong":"const html = require('rollup-plugin-html')","symbol":"default","correct":"import html from 'rollup-plugin-html'"},{"note":"Named import 'html' does not exist; only default export.","wrong":"import { html } from 'rollup-plugin-html'","symbol":"html","correct":"import html from 'rollup-plugin-html'"},{"note":"In CJS, require returns the default export directly.","wrong":"const { default: html } = require('rollup-plugin-html')","symbol":"rollup-plugin-html","correct":"const html = require('rollup-plugin-html');"}],"quickstart":{"code":"// rollup.config.js\nimport html from 'rollup-plugin-html';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    html({\n      include: '**/*.html',\n      exclude: '**/excluded.html',\n      htmlMinifierOptions: {\n        collapseWhitespace: true\n      }\n    })\n  ]\n};\n\n// main.js\nimport template from './template.html';\ndocument.body.innerHTML = template;","lang":"javascript","description":"Shows how to configure rollup-plugin-html in a rollup config and import an HTML file as a string."},"warnings":[{"fix":"Consider migrating to @rollup/plugin-html or use vite-plugin-html for modern builds.","message":"The package is in maintenance mode; no recent updates and may not work with Rollup 3+.","severity":"deprecated","affected_versions":">=0.2.1"},{"fix":"Use a separate plugin for SVG or XML imports.","message":"The plugin does not handle SVG files or non-HTML XML; only .html extensions.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure options match html-minifier documentation.","message":"htmlMinifierOptions are passed directly to html-minifier; invalid options may cause errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set include option to include node_modules: include: ['**/*.html', 'node_modules/**/*.html']","message":"The include default is '**/*.html' but excludes node_modules by default; custom include patterns must explicitly include node_modules if needed.","severity":"gotcha","affected_versions":">=0.1.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 --save-dev rollup-plugin-html and ensure correct import syntax.","cause":"Package not installed or incorrect import path.","error":"Error: Could not resolve module 'rollup-plugin-html'"},{"fix":"Use import html from 'rollup-plugin-html' rather than import { html } from 'rollup-plugin-html'.","cause":"Using named import instead of default import.","error":"TypeError: html is not a function"},{"fix":"Add html() to the plugins array in rollup.config.js.","cause":"Plugin not included in rollup config plugins array.","error":"ReferenceError: html is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}