{"id":25307,"library":"esbuild-obfuscator-plugin","title":"esbuild-obfuscator-plugin","description":"A plugin for esbuild that integrates JavaScript code obfuscation into the build pipeline. Version 0.0.5, actively developed with no regular release cadence. Differentiates by providing simple configuration via esbuild plugins, supporting various obfuscation options like control flow flattening and string encoding. Primarily used for protecting frontend code. Ships TypeScript types.","status":"active","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/shahradelahi/esbuild-obfuscator-plugin","tags":["javascript","esbuild","obfuscator","obfuscator-plugin","typescript"],"install":[{"cmd":"npm install esbuild-obfuscator-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-obfuscator-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-obfuscator-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin requires esbuild to function.","package":"esbuild","optional":false}],"imports":[{"note":"Package is ESM-only. CommonJS require will fail.","wrong":"const obfuscatorPlugin = require('esbuild-obfuscator-plugin')","symbol":"default","correct":"import obfuscatorPlugin from 'esbuild-obfuscator-plugin'"},{"note":"The package exports a default function, not a named export.","wrong":"import { obfuscatorPlugin } from 'esbuild-obfuscator-plugin'","symbol":"obfuscatorPlugin","correct":"import obfuscatorPlugin from 'esbuild-obfuscator-plugin'"},{"note":"Type import for TypeScript users; runtime import is not needed.","wrong":"","symbol":"ObfuscatorOptions","correct":"import type { ObfuscatorOptions } from 'esbuild-obfuscator-plugin'"}],"quickstart":{"code":"import obfuscatorPlugin from 'esbuild-obfuscator-plugin';\nimport esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: ['src/index.js'],\n  bundle: true,\n  outfile: 'dist/bundle.js',\n  plugins: [obfuscatorPlugin({\n    controlFlowFlattening: true,\n    stringArrayEncoding: ['base64']\n  })],\n});","lang":"typescript","description":"Bundles a JavaScript file with esbuild and obfuscates the output using control flow flattening and base64 string array encoding."},"warnings":[{"fix":"Use esbuild.build() instead of esbuild.transform().","message":"Plugin only works with esbuild's build API, not transform API.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Test obfuscation on realistic builds and consider performance impact.","message":"Obfuscation can significantly increase bundle size and degrade runtime performance.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set sourcemap: false in esbuild config if source maps are not needed.","message":"Source maps become inaccurate after obfuscation.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use import syntax or dynamic import().","message":"Plugin is ESM-only; CommonJS require() throws an error.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Pass obfuscation options directly as shown in the quickstart.","message":"Options like `seed` and `options` are deprecated in favor of top-level fields.","severity":"deprecated","affected_versions":"0.0.4"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use dynamic import: import obfuscatorPlugin from 'esbuild-obfuscator-plugin';","cause":"Package is ESM-only, not compatible with CommonJS require.","error":"const obfuscatorPlugin = require('esbuild-obfuscator-plugin');"},{"fix":"Use esbuild.build() with the plugin in the plugins array.","cause":"Plugin is designed for build API only.","error":"Error: The obfuscator plugin must be used with esbuild.build(), not esbuild.transform()."},{"fix":"Ensure import is default: import obfuscatorPlugin from 'esbuild-obfuscator-plugin';","cause":"Default import used incorrectly as a named import.","error":"TypeError: obfuscatorPlugin is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}