rollup-plugin-obfuscator is a powerful Rollup plugin designed to integrate `javascript-obfuscator` into the build process. Unlike some alternatives, this plugin requires `javascript-obfuscator` to be installed as a separate peer dependency, ensuring users can always utilize the latest version of the obfuscator. The current stable version is 1.1.0, with updates typically aligning with new releases or needs of `javascript-obfuscator`. A key differentiator is its ability to perform obfuscation either on the entire bundle or, more efficiently, on individual files while excluding open-source dependencies, leading to significant performance improvements during the build process. It provides granular control over which files are obfuscated via include/exclude patterns and supports all configuration options available in `javascript-obfuscator` itself.
npm install rollup-plugin-obfuscatorVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to apply obfuscation to a Rollup bundle using the `rollup-plugin-obfuscator`. It shows the basic plugin setup and includes common `javascript-obfuscator` options for a strong obfuscation.
Run `npm install --save-dev rollup-plugin-obfuscator javascript-obfuscator` or `yarn add --dev rollup-plugin-obfuscator javascript-obfuscator`.
Review your `include` and `exclude` arrays, especially if you observe unexpected obfuscation or non-obfuscation. The default `exclude: ['node_modules/**']` is usually sufficient, but might need adjustment for monorepos or specific build setups.
Start with milder obfuscation options and incrementally increase complexity. Rigorously test your application's functionality in a production-like environment after obfuscation. Consult the `javascript-obfuscator` documentation for details on each option.
Install `javascript-obfuscator` alongside the plugin: `npm install --save-dev javascript-obfuscator`.
Ensure `javascript-obfuscator` is installed and the plugin configuration is syntactically correct, particularly the `options` object. Check your Rollup configuration for correct plugin array syntax.
Verify that the `options` property within the plugin configuration is a valid object, e.g., `obfuscator({ options: { /* ... */ } })`.