{"id":21928,"library":"rollup-plugin-bookmarklet","title":"rollup-plugin-bookmarklet","description":"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.","status":"active","version":"5.0.12","language":"javascript","source_language":"en","source_url":"https://github.com/rollup-community/rollup-plugin-bookmarklet","tags":["javascript","rollup","plugin","rollup-plugin","bookmarklet","typescript"],"install":[{"cmd":"npm install rollup-plugin-bookmarklet","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-bookmarklet","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-bookmarklet","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - the plugin operates within Rollup's plugin system","package":"rollup","optional":false}],"imports":[{"note":"ESM-only package. Use default import. CommonJS require is not supported.","wrong":"const bookmarklet = require('rollup-plugin-bookmarklet')","symbol":"default (bookmarklet)","correct":"import bookmarklet from 'rollup-plugin-bookmarklet'"},{"note":"TypeScript users can import the options type for type safety. Not needed in JS.","wrong":null,"symbol":"BookmarkletOptions","correct":"import type { BookmarkletOptions } from 'rollup-plugin-bookmarklet'"},{"note":"bookmarklet is a function, not a constructor. Do not use 'new'.","wrong":"new bookmarklet()","symbol":"bookmarklet function call","correct":"bookmarklet()"}],"quickstart":{"code":"import bookmarklet from 'rollup-plugin-bookmarklet';\nimport terser from '@rollup/plugin-terser';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    terser(),\n    bookmarklet()\n  ]\n};","lang":"javascript","description":"Shows how to configure Rollup with the bookmarklet plugin to produce a minified bookmarklet."},"warnings":[{"fix":"Upgrade Node.js to version 18 or later.","message":"Requires Node.js >=18","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use Rollup v2, v3, or v4.","message":"Drop support for Rollup v1","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure to invoke bookmarklet() as a function in your Rollup plugins array.","message":"Deprecated usage: not calling bookmarklet() as a function","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set output.format to 'iife' in your Rollup configuration.","message":"Output format must be 'iife' for bookmarklet to work correctly","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Order plugins: minification first, then bookmarklet.","message":"Must be placed after minification plugins like terser to avoid syntax errors","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":"Run 'npm install -D rollup-plugin-bookmarklet' and use correct import.","cause":"Package not installed or wrong import path","error":"Cannot find module 'rollup-plugin-bookmarklet'"},{"fix":"Use 'import bookmarklet from 'rollup-plugin-bookmarklet'' in ESM context.","cause":"Using require() instead of import on ESM-only package","error":"The plugin 'bookmarklet' doesn't export a valid plugin object"},{"fix":"Reorder plugins: put terser() before bookmarklet().","cause":"Bookmarklet plugin applied before minification","error":"Error: Unexpected token: punc ())"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}