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.

If I can unobfuscator my code whithout node_modules library?

See original GitHub issue

I use some library in node_modules,but webpack-obfuscator act on compilation.assets,so all my code and library obfuscator。

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
vesper8commented, Feb 17, 2020

This is what worked for me to make sure my js/chunk-vendors.hash.js is not obfuscated since it’s by far the largest file

const obfuscatorPlugin = new JavaScriptObfuscator({
  rotateUnicodeArray: true,
}, [
  '**/chunk-vendors.*.js',
]);
2reactions
mauricedoepkecommented, Jun 25, 2019

You need to create two separate bundles, one with your one code and one with the node_modules. Then you tell the obfuscator to ignore the node_modules bundle.

Add the following to your webpack config to create different bundles for your own code and for libraries.

    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    test: /node_modules/,
                    chunks: 'initial',
                    name: 'vendor',
                    enforce: true
                },
            }
        }
    },

And then tell the obfuscator to ignore the node_modules bundle with:

        new JavaScriptObfuscator({
        }, ['**_vendor.js'])

You might have to change ‘**_vendor.js’ to fit your filenames

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Is it possible to use the javascript-obfuscator library ...
Yes, this is possible, but it is not reasonable, because client's browser firstly download the JavaScript source code, code of the library, ...
Read more >
javascript-obfuscator - npm
Enables source map generation for obfuscated code. Source maps can be useful to help you debug your obfuscated JavaScript source code. If you ......
Read more >
JavaScript Obfuscator Tool
This tool transforms your original JavaScript source code into a new representation that's harder to understand, copy, re-use and modify without authorization.
Read more >
Obfuscating JavaScript code with Node.js - DEV Community ‍ ‍
In this article, I'll be showing you how you can obfuscate your code with the JavaScript Obfuscator library in Node.js.
Read more >
Learn How To Obfuscate JavaScript with Node.js
The obfuscator is free and open source which is written in TypeScript and it's BSD-2-Clause licensed. You can see an online implementation of...
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