Registry / web-framework / rollup-plugin-string

rollup-plugin-string

JSON →
library3.0.0jsnpmunverified

Convert text files (e.g., HTML, CSS, SVG) into ES modules for Rollup. v3.0.0 is the current stable version (no recent updates, maintenance mode). Key differentiator: lightweight, simple include/exclude patterns, no dependencies. Alternatives like rollup-plugin-glsl or rollup-plugin-stringify offer similar functionality with different features.

web-frameworkdevops
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.

Use named import. Default export is not available.

import { string } from 'rollup-plugin-string'

For CommonJS, destructure the named export.

const { string } = require('rollup-plugin-string')

Do not reference internal path; use package name directly.

import { string } from 'rollup-plugin-string'

Converts all .html files (except index.html) into ES modules using Rollup.

import { rollup } from 'rollup'; import { string } from 'rollup-plugin-string'; const bundle = await rollup({ input: 'main.js', plugins: [ string({ include: '**/*.html', exclude: '**/index.html' }) ] }); const { code } = await bundle.generate({ format: 'esm' }); console.log(code);
Debug
Known footguns
gotchainclude option is required; plugin will skip all files if missing.
gotchaThe plugin only works with Rollup – not Webpack, esbuild, or Vite.
deprecatedRollup v4 is not officially tested; may break on future versions.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources