Rollup plugin that prepends the 'javascript:' prefix to the bundle output, converting a script into a bookmarklet. Current stable version is 5.0.12, released under a semver cadence. It supports Rollup v2, v3, and v4. Unlike manual prefixing, this plugin integrates seamlessly into the build pipeline and works with minifiers like @rollup/plugin-terser. It ships TypeScript type definitions and requires Node.js >=18. Key differentiator: minimal, focused plugin that does one thing with zero configuration.
npm install rollup-plugin-bookmarkletVerified import paths — ran on the pinned version, not inferred.
Shows how to configure Rollup with the bookmarklet plugin to produce a minified bookmarklet.
Upgrade Node.js to version 18 or later.
Use Rollup v2, v3, or v4.
Ensure to invoke bookmarklet() as a function in your Rollup plugins array.
Set output.format to 'iife' in your Rollup configuration.
Order plugins: minification first, then bookmarklet.
Run 'npm install -D rollup-plugin-bookmarklet' and use correct import.
Use 'import bookmarklet from 'rollup-plugin-bookmarklet'' in ESM context.
Reorder plugins: put terser() before bookmarklet().