question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore files / directories?

See original GitHub issue

First 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:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Jan 6, 2021

Yes. If a file is excluded - it should not be produced by the obfuscator. I just interested in this error:

throw new Error(errorMessage);

Want to understand why it’s happening.

About your glob. Try this: lib/templates/**/** without ./ characters at the start. I tested and it works

1reaction
maka-iocommented, Jan 6, 2021

Hey @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:

/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);
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found