A Metro bundler minifier plugin that integrates javascript-obfuscator for React Native apps. Current stable version is 1.0.1. It obfuscates during the minification step, preserving correct source maps, unlike alternatives that obfuscate during transformation. Provides configurable filtering, default obfuscator options (control flow flattening, string splitting, self-defending), and supports both CJS and ESM project configurations via metro.config.js. Requires a default minifier (metro-minify-uglify or metro-minify-terser) when using file filtering.
npm install metro-minify-obfuscatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures Metro to use metro-minify-obfuscator as the minifier, with a file filter and default options.
Add defaultMinifierPath property pointing to an installed minifier (metro-minify-uglify or metro-minify-terser). If not using filter, omit or set to false.
Test obfuscatorOptions thoroughly. Common problematic options include stringArray (disabled by default) and selfDefending (can cause app crashes). Start with default options and add incrementally.
Run `npx react-native start --reset-cache` or delete node_modules/.metro folder.
Update metro.config.js to include defaultMinifierPath as shown in the README release notes.
Install the package: npm install --save-dev metro-minify-uglify (or metro-minify-terser for newer RN).
Check javascript-obfuscator documentation for correct option names. Ensure options are under obfuscatorOptions key, not top-level minifierConfig.
Ensure minifierPath is set to 'metro-minify-obfuscator' as a string in transformer config.
Disable selfDefending option: set to false in obfuscatorOptions, or test other options that might affect prototypes.