react-native-obfuscator icon indicating copy to clipboard operation
react-native-obfuscator copied to clipboard

How to exclude a file from obfuscation?

Open sinkz opened this issue 6 years ago • 1 comments

Hi, i need exlude a file from obfuscation because i receive error when this file is obfuscated.

How i can exclude files?

Error: error SyntaxError in src/overlay/index.tsx: Unexpected token (1:2849). Run CLI with --verbose flag for more details. SyntaxError: Unexpected token (1:2849) at Parser.pp$5.raise (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:4454:13) at Parser.pp.unexpected (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:1761:8) at Parser.pp$3.parseExprAtom (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3627:50) at Parser.pp$3.parseExprSubscripts (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3494:19) at Parser.pp$3.parseMaybeUnary (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3474:19) at Parser.pp$3.parseExprOps (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3404:19) at Parser.pp$3.parseMaybeConditional (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3381:19) at Parser.pp$3.parseMaybeAssign (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3344:19) at Parser.pp$3.parseExpression (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:3306:19) at Parser.pp$1.parseReturnStatement (/Users/objective/Documents/Desenvolvimento/b2b-experience-app/packages/app/node_modules/babylon/lib/index.js:2078:26)

sinkz avatar Nov 16 '20 20:11 sinkz

i solved. In transformer.js file i placed this validation:

const excludedFiles = ['src/overlay/index.tsx'];
const filter = (filename) => {
  if (excludedFiles.includes(filename)) return;
  return filename.startsWith('src');
};

sinkz avatar Nov 17 '20 18:11 sinkz