Git Product home page Git Product logo

Comments (5)

vesper8 avatar vesper8 commented on May 27, 2024 16

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',
]);

from webpack-obfuscator.

mauricedoepke avatar mauricedoepke commented on May 27, 2024 2

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

from webpack-obfuscator.

TorRanfelt avatar TorRanfelt commented on May 27, 2024 1

@techterbium Excludes are on the generated files. Not on the original source files.

from webpack-obfuscator.

techterbium avatar techterbium commented on May 27, 2024

I just ran into this problem. I tried to configure excludes to ignore all node_modules but it did not work.

      new JavaScriptObfuscator({
           compact: true,
           controlFlowFlattening: true,
           controlFlowFlatteningThreshold: 0.75,
           deadCodeInjection: true,
           log: false,
           rotateUnicodeArray: true
       }, ['node_modules/**/*.js'])

Can you help me with working example?

from webpack-obfuscator.

sanex3339 avatar sanex3339 commented on May 27, 2024

Closed as old. Fell free to create a new issue.

from webpack-obfuscator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.