Closed toddrimes closed 4 years ago
I tried to log the obfuscated code out but it seems no obfuscation happens :(
If you want to create output files with suffix '.obfuscated.js', set emitObfuscatedFiles: true.
Example:
module.exports = obfuscatingTransformer({
upstreamTransformer: require("metro-react-native-babel-transformer"),
trace: true,
filter: filename => filename.startsWith("src"),
emitObfuscatedFiles: true,
obfuscatorOptions: {
compact: true,
controlFlowFlattening: false,
controlFlowFlatteningThreshold: 1,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
emitObfuscatedFiles: true,
enableInDevelopment: true,
// identifierNamesGenerator: 'mangled',
log: false,
renameGlobals: false,
rotateStringArray: false,
selfDefending: false,
stringArray: false,
stringArrayEncoding: false,
target: 'browser-no-eval',
// stringArrayThreshold: 1,
trace: true,
transformObjectKeys: false,
unicodeEscapeSequence: false
}
})
Thank you. I have it set to true in my original post (as you can see above), but I did not have a separate 'obfuscatorOptions' like you do. I'll give that a try if I decide to try obfuscation again. After reading several posts about it, it seemed a rather futile way to discourage code-theft anyway. :(
I installed with 'npm install react-native-obfuscating-transformer --save-dev'. I have this in metro.config.js:
...and this in transformer.js:
But when I do 'react-native run-ios --configuration [Debug | Release]', nothing happens and no new files like *-obfuscated.js' appear. I get no errors, either.
What have I missed?
Thank you, ~Todd