{"id":22093,"library":"rollup-plugin-javascript-obfuscator","title":"rollup-plugin-javascript-obfuscator","description":"A Rollup plugin that uses javascript-obfuscator to obfuscate bundled JavaScript code. Version 1.0.4 (latest) wraps javascript-obfuscator v4.x, allowing control over obfuscation options directly in the Rollup build pipeline. It supports source maps (inline or separate) and enables protection of emitted code with minimal setup. Differentiates by tightly integrating obfuscation within the bundle output, rather than requiring a separate post-build step.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","rollup","rollup-plugin","obfuscate","obfuscation","javascript-obfuscator"],"install":[{"cmd":"npm install rollup-plugin-javascript-obfuscator","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-javascript-obfuscator","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-javascript-obfuscator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core obfuscation engine, version >=4.0.0 is required","package":"javascript-obfuscator","optional":false},{"reason":"peer dependency, plugin runs in Rollup build lifecycle","package":"rollup","optional":true}],"imports":[{"note":"Default export, not named. Use this for ESM.","wrong":"import { obfuscatorPlugin } from 'rollup-plugin-javascript-obfuscator'","symbol":"obfuscatorPlugin","correct":"import obfuscatorPlugin from 'rollup-plugin-javascript-obfuscator'"},{"note":"For CommonJS environments like Node.js with CJS.","wrong":"const { obfuscatorPlugin } = require('rollup-plugin-javascript-obfuscator')","symbol":"obfuscatorPlugin (require)","correct":"const obfuscatorPlugin = require('rollup-plugin-javascript-obfuscator')"},{"note":"Rollup main export is named, not default.","wrong":"import rollup from 'rollup'","symbol":"rollup","correct":"import { rollup } from 'rollup'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport obfuscatorPlugin from 'rollup-plugin-javascript-obfuscator';\n\nasync function build() {\n  const bundle = await rollup({\n    input: 'src/index.js',\n    plugins: [\n      obfuscatorPlugin({\n        compact: true,\n        controlFlowFlattening: false,\n        stringArrayEncoding: ['base64']\n      })\n    ]\n  });\n  await bundle.write({ file: 'dist/bundle.js', format: 'esm' });\n}\nbuild().catch(console.error);","lang":"javascript","description":"Complete Rollup build pipeline with obfuscation plugin applied to ES module bundle."},"warnings":[{"fix":"Use obfuscator options judiciously; avoid high-complexity transforms like controlFlowFlattening if performance is critical","message":"Obfuscation can significantly increase bundle size and reduce runtime performance","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"npm install --save-dev javascript-obfuscator@^4.0.0","message":"The plugin expects javascript-obfuscator v4.x. Install it explicitly if not already present.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Replace 'entry' with 'input'","message":"The 'entry' option used in example README is deprecated in Rollup v2+","severity":"deprecated","affected_versions":">=0.66.0"},{"fix":"Test with source map enabled; use inline source maps for simpler setup","message":"Source maps may not work correctly if obfuscation corrupts mappings","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Create a custom declaration file or use @ts-ignore","message":"The package does not export TypeScript definitions","severity":"breaking","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":"npm install --save-dev javascript-obfuscator","cause":"Missing peer dependency","error":"Error: Cannot find module 'javascript-obfuscator'"},{"fix":"Use default import: import obfuscatorPlugin from 'rollup-plugin-javascript-obfuscator'","cause":"Incorrect import (named instead of default)","error":"TypeError: obfuscatorPlugin is not a function"},{"fix":"Replace 'entry' with 'input' in your rollup configuration","cause":"Used deprecated Rollup option 'entry'","error":"Error: The 'entry' option is deprecated. Use 'input' instead."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}