{"id":21908,"library":"rollup-obfuscator","title":"Rollup Obfuscator","description":"A Rollup and Vite plugin for obfuscating JavaScript bundles using javascript-obfuscator. Current stable version is 4.1.1, released in September 2024. It supports Rollup v2, v3, and v4, and Vite build-time only. Key differentiators: it works as an end-of-pipeline plugin, filters files by pattern, and sets sensible defaults (sourceMap: true, stringArray: false) to reduce breakage. Requires Node 16+ and javascript-obfuscator v4 as a peer dependency. The plugin is actively maintained with regular releases addressing bugs and compatibility.","status":"active","version":"4.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/ghostdevv/rollup-obfuscator","tags":["javascript","obfuscator","rollup","rollup obfuscator","rollup plugin","plugin","rollup plugin obfuscator","rollup-obfuscator","javascript obfuscator","typescript"],"install":[{"cmd":"npm install rollup-obfuscator","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-obfuscator","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-obfuscator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core obfuscation library; peer dependency v4.x","package":"javascript-obfuscator","optional":false}],"imports":[{"note":"Named export only; no default export. Requires ESM.","wrong":"const obfuscator = require('rollup-obfuscator')","symbol":"obfuscator","correct":"import { obfuscator } from 'rollup-obfuscator'"},{"note":"Default import is not available. Must use named import.","wrong":"import obfuscator from 'rollup-obfuscator'","symbol":"obfuscator default","correct":"import { obfuscator } from 'rollup-obfuscator'"},{"note":"TypeScript types are bundled; ObfuscatorOptions type is exported for plugin config.","wrong":"","symbol":"Type definitions","correct":"import type { ObfuscatorOptions } from 'rollup-obfuscator'"}],"quickstart":{"code":"// rollup.config.js\nimport { obfuscator } from 'rollup-obfuscator';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    // other plugins...\n    obfuscator({\n      // javascript-obfuscator options (optional)\n      compact: true,\n      controlFlowFlattening: false,\n      // plugin-specific options\n      include: ['**/*.js'],\n      exclude: ['node_modules/**']\n    })\n  ]\n};","lang":"typescript","description":"Basic Rollup configuration with obfuscator plugin at the end of plugins array, demonstrating import and usage."},"warnings":[{"fix":"Remove options.global from your plugin call. The default behavior now matches v3's global: false.","message":"v4 removed options.global. The option no longer exists.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade Node to v16 or later.","message":"v4 requires Node 16+. Older Node versions are not supported.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"If you rely on the old defaults, explicitly set sourceMap: false and stringArray: true in options.","message":"v4 changed default obfuscator options: sourceMap now defaults to true, stringArray defaults to false.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Always list obfuscator() as the last plugin.","message":"Plugin must be placed at the end of the plugins array to ensure other transforms run before obfuscation.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Run 'npm install javascript-obfuscator --save-dev'.","message":"javascript-obfuscator is a peer dependency; you must install it separately or the plugin will fail.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use import { obfuscator } from 'rollup-obfuscator' instead of import obfuscator from 'rollup-obfuscator'.","message":"In v2, the library used a default export; v3+ switched to named export 'obfuscator'.","severity":"deprecated","affected_versions":">=3.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 javascript-obfuscator --save-dev","cause":"Missing peer dependency javascript-obfuscator","error":"Error: Cannot find module 'javascript-obfuscator'"},{"fix":"Change to: import { obfuscator } from 'rollup-obfuscator';","cause":"Using default import instead of named import (v3+).","error":"TypeError: obfuscator is not a function"},{"fix":"Move the obfuscator() call to the last position in the plugins array.","cause":"Plugin placed before other plugins that generate output.","error":"Error: Rollup plugin 'rollup-obfuscator' must be at the end of the plugins array"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}