{"id":25317,"library":"esbuild-plugin-bookmarklet","title":"esbuild-plugin-bookmarklet","description":"An ESM-only, Deno-first esbuild plugin that generates bookmarklet code from JavaScript entry points. Current stable version 1.1.0 (2024) is covered by semver. It wraps esbuild output into a URL-encoded bookmarklet, requiring `iife` format and `write: false`. Differentiators: Deno-first (supports Node), simple setup, supports multiple entry points since v1.1.0.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/reesericci/esbuild-bookmarklet","tags":["javascript"],"install":[{"cmd":"npm install esbuild-plugin-bookmarklet","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-bookmarklet","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-bookmarklet","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin hooks into esbuild's build process","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only; CommonJS require will fail. Use import statement.","wrong":"const bookmarkletPlugin = require('esbuild-plugin-bookmarklet')","symbol":"default","correct":"import bookmarkletPlugin from 'esbuild-plugin-bookmarklet'"},{"note":"Deno import should pin a version (e.g., @1.1.0) to avoid breaking changes.","wrong":"import bookmarkletPlugin from 'https://deno.land/x/esbuild_plugin_bookmarklet/mod.js'","symbol":"default","correct":"import bookmarkletPlugin from 'https://deno.land/x/esbuild_plugin_bookmarklet@1.1.0/mod.js'"},{"note":"Ensure package.json has 'type': 'module' or use .mjs extension.","wrong":"","symbol":"default","correct":"import bookmarkletPlugin from 'esbuild-plugin-bookmarklet' // in Node ESM"}],"quickstart":{"code":"import * as esbuild from 'esbuild';\nimport bookmarkletPlugin from 'esbuild-plugin-bookmarklet';\n\nawait esbuild.build({\n  entryPoints: ['index.js'],\n  bundle: true,\n  minify: true,\n  outfile: 'bookmarklet.js',\n  write: false,\n  format: 'iife',\n  plugins: [bookmarkletPlugin],\n  target: ['chrome58', 'firefox57', 'safari11', 'edge16']\n});\n\nconsole.log('Bookmarklet generated as bookmarklet.js');","lang":"javascript","description":"Minimal Node ESM build script that outputs a bookmarklet from index.js."},"warnings":[{"fix":"Set write: false in esbuild options.","message":"Requires esbuild's `write: false` option; output is handled by plugin, not filesystem.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Specify format: 'iife' in esbuild config.","message":"Plugin only works with `format: 'iife'`; other formats may produce invalid bookmarklets.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import with version tag: https://deno.land/x/esbuild_plugin_bookmarklet@1.1.0/mod.js","message":"Deno import without version pin may break with future releases.","severity":"deprecated","affected_versions":"all"},{"fix":"Use import syntax. If in Node, ensure 'type': 'module' in package.json or rename file to .mjs.","message":"ESM-only package; using require() results in error: require() of ES Module not supported.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to v1.1.0 or later for multiple entry points.","message":"Multiple entry points are supported since v1.1.0; earlier versions only handle single entry.","severity":"gotcha","affected_versions":"1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install esbuild-plugin-bookmarklet' and use correct import: import bookmarkletPlugin from 'esbuild-plugin-bookmarklet'","cause":"Package not installed or import path incorrect in Node.","error":"Error: Cannot find module 'esbuild-plugin-bookmarklet'"},{"fix":"Use default import: import bookmarkletPlugin from 'esbuild-plugin-bookmarklet' (no braces).","cause":"Used default import incorrectly (e.g., destructured non-default export).","error":"TypeError: bookmarkletPlugin is not a function"},{"fix":"Add format: 'iife' to esbuild options.","cause":"Build format missing or not set to 'iife'.","error":"Error: The plugin \"esbuild-plugin-bookmarklet\" rejected the build because the format is not 'iife'"},{"fix":"Add write: false to esbuild options.","cause":"The write option in esbuild is true (default) or not set.","error":"Error: \"write\" must be false when using this plugin"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}