Registry / devops / rollup-plugin-bookmarklet

rollup-plugin-bookmarklet

JSON →
library5.0.12jsnpmunverified

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-bookmarklet
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-BOOK
R
rollup-plugin-bookmarklet
devopsjavascriptv5.0.12
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (bookmarklet)
import bookmarklet from 'rollup-plugin-bookmarklet'
const bookmarklet = require('rollup-plugin-bookmarklet')
ESM-only package. Use default import. CommonJS require is not supported.
BookmarkletOptions
import type { BookmarkletOptions } from 'rollup-plugin-bookmarklet'
TypeScript users can import the options type for type safety. Not needed in JS.
bookmarklet function call
bookmarklet()
new bookmarklet()
bookmarklet is a function, not a constructor. Do not use 'new'.

Shows how to configure Rollup with the bookmarklet plugin to produce a minified bookmarklet.

import bookmarklet from 'rollup-plugin-bookmarklet'; import terser from '@rollup/plugin-terser'; export default { input: 'src/main.js', output: { file: 'bundle.js', format: 'iife' }, plugins: [ terser(), bookmarklet() ] };
Debug
Known issues
breakingRequires Node.js >=18
fix
Upgrade Node.js to version 18 or later.
affects: >=5.0.0
breakingDrop support for Rollup v1
fix
Use Rollup v2, v3, or v4.
affects: >=4.0.0
deprecatedDeprecated usage: not calling bookmarklet() as a function
fix
Ensure to invoke bookmarklet() as a function in your Rollup plugins array.
affects: >=1.0.0
gotchaOutput format must be 'iife' for bookmarklet to work correctly
fix
Set output.format to 'iife' in your Rollup configuration.
affects: >=1.0.0
gotchaMust be placed after minification plugins like terser to avoid syntax errors
fix
Order plugins: minification first, then bookmarklet.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'rollup-plugin-bookmarklet'
Package not installed or wrong import path
fix
Run 'npm install -D rollup-plugin-bookmarklet' and use correct import.
The plugin 'bookmarklet' doesn't export a valid plugin object
Using require() instead of import on ESM-only package
fix
Use 'import bookmarklet from 'rollup-plugin-bookmarklet'' in ESM context.
Error: Unexpected token: punc ())
Bookmarklet plugin applied before minification
fix
Reorder plugins: put terser() before bookmarklet().
Upgrade
Version history
5.0.12latest on npm
Audit
Dependencies
rolluprequiredPeer dependency - the plugin operates within Rollup's plugin system
Agent activity
10 hits · last 30 days
node
6
OpenAI (training)
2
Resources
rollup-plugin-bookmarklet — npm install rollup-plugin-bookmarklet · libregistry