{"id":22161,"library":"rollup-plugin-post-obfuscator","title":"rollup-plugin-post-obfuscator","description":"Rollup plugin that obfuscates JavaScript output after the bundle is generated. Current stable version is 1.0.0. It leverages javascript-obfuscator under the hood and supports dynamic import obfuscation, inclusion/exclusion patterns, and source map handling. Unlike other obfuscation plugins that operate during the build process, this plugin post-processes the output, making it compatible with various output formats and easier to integrate. It ships TypeScript types and requires Node >=16 and Rollup <5.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/KongYanHHHH/rollup-plugin-post-obfuscator","tags":["javascript","rollup-plugin","obfuscator","supports dynamic import obfuscation","typescript"],"install":[{"cmd":"npm install rollup-plugin-post-obfuscator","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-post-obfuscator","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-post-obfuscator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; works with Rollup versions below 5.","package":"rollup","optional":false},{"reason":"Underlying obfuscation engine used by the plugin.","package":"javascript-obfuscator","optional":false}],"imports":[{"note":"Plugin uses ESM only; CJS require may fail in older Node versions <16.","wrong":"const obfuscator = require('rollup-plugin-post-obfuscator')","symbol":"default (obfuscator)","correct":"import obfuscator from 'rollup-plugin-post-obfuscator'"},{"note":"The plugin is exported as default, not named.","wrong":"import { obfuscator } from 'rollup-plugin-post-obfuscator'","symbol":"default in Rollup config","correct":"import obfuscator from 'rollup-plugin-post-obfuscator';\nexport default { plugins: [obfuscator()] }"},{"note":"For TypeScript, use type import for options types.","wrong":"","symbol":"TypeScript type","correct":"import type { ObfuscatorOptions } from 'rollup-plugin-post-obfuscator'"}],"quickstart":{"code":"// rollup.config.js\nimport obfuscator from 'rollup-plugin-post-obfuscator';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'es',\n  },\n  plugins: [\n    obfuscator({\n      outDir: 'dist',\n      include: ['**/*.js'],\n      exclude: ['vendor/**'],\n      JavaScriptObfuscatorOptions: {\n        compact: true,\n        controlFlowFlattening: true,\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Basic Rollup config using the obfuscator plugin with typical options including include/exclude patterns and custom javascript-obfuscator options."},"warnings":[{"fix":"Use Rollup 4 or earlier.","message":"Plugin requires Rollup <5; using with Rollup 5 will cause a peer dependency warning and may break.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set obfuscator({ outDir: output.dir }) or ensure consistency.","message":"The 'outDir' option must match Rollup's output.dir exactly; otherwise, the plugin may fail to find generated files.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with source maps or disable them if obfuscation breaks them.","message":"Obfuscation of source maps is not well documented; if source maps are enabled, the plugin may not update them correctly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with your specific format; consider using 'es' or 'cjs'.","message":"Dynamic import obfuscation may not work reliably with all output formats (e.g., SystemJS).","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 --save-dev rollup-plugin-post-obfuscator'","cause":"Missing npm install or using wrong package name.","error":"Error: Cannot find module 'rollup-plugin-post-obfuscator'"},{"fix":"Use 'import obfuscator from ...' not '{ obfuscator }'.","cause":"Named import instead of default import.","error":"TypeError: obfuscator is not a function"},{"fix":"Downgrade Rollup to 4.x.","cause":"Plugin requires Rollup <5, but Rollup 5 is installed.","error":"ERR_PEER_DEP_INVALID: rollup@5.0.0 invalid for rollup-plugin-post-obfuscator@1.0.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}