Ignore files / directories?
See original GitHub issueFirst off, great project, thank you!
I’m trying to prevent obfuscation of a directory because the javascript-obfuscatory is erring on unexpected tokens. I’m sure it’s the nature of the files that are being obfuscated, and that’s fine. I tried adding:
/* javascript-obfuscator:disable */
However, the obfuscation process still seems to at least be reading the files (even though they aren’t being obfuscated) and therefore still throwing an error. So my question is:
Is it possible to actively ignore a file or, better yet, an entire directory?
For reference, this is the error:
/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/ASTParserFacade.ts:56
throw new Error(errorMessage);
^
Error: Unexpected token (3:0)
at Function.processParsingError (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/ASTParserFacade.ts:56:19)
at Function.parse (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/ASTParserFacade.ts:39:49)
at o.parseCode (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/JavaScriptObfuscator.ts:81:50)
at obfuscate (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/JavaScriptObfuscator.ts:72:30)
at Function.obfuscate (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/JavaScriptObfuscatorFacade.ts:16:53)
at P.apply (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/cli/JavaScriptObfuscatorCLI.ts:197:82)
at P.processSourceCodeWithoutSourceMap (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/decorators/Initializable.ts:61:39)
at P.apply (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/cli/JavaScriptObfuscatorCLI.ts:193:18)
at P.processSourceCode (/Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/decorators/Initializable.ts:61:39)
at /Users/mjc/.nvm/versions/node/v12.18.4/lib/node_modules/javascript-obfuscator/dist/webpack:/javascript-obfuscator/src/cli/JavaScriptObfuscatorCLI.ts:177:22
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
.gitignore File – How to Ignore Files and Folders in Git
Inside .gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern...
Read more >Ignoring directories in Git repositories on Windows
Create a file named .gitignore in your project's directory. Ignore directories by entering the directory name into the file (with a slash appended):...
Read more >gitignore Documentation - Git
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below...
Read more >.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >Ignoring Files and Directories in Git (.gitignore) - Linuxize
The .gitignore file allows you to exclude files from being checked into the repository. It contains globbing patterns that describe which ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. If a file is excluded - it should not be produced by the obfuscator. I just interested in this error:
Want to understand why it’s happening.
About your glob. Try this:
lib/templates/**/**
without./
characters at the start. I tested and it worksHey @sanex3339 , Thanks for the reply. I gave that a shot, but no dice.
javascript-obfuscator ./lib --exclude=./lib/templates/ --output ./lib-o --config=obfuscator.json
still results in: