javascript-obfuscator / webpack-obfuscator

javascript-obfuscator plugin for Webpack
https://github.com/javascript-obfuscator/javascript-obfuscator
BSD 2-Clause "Simplified" License
870 stars 82 forks source link

Getting HEAPU32 not defined #129

Closed djaffer closed 2 years ago

djaffer commented 2 years ago

image How do I fix this issue?

djaffer commented 2 years ago

I am using react. I got it to work by separating out node modules. The documentation can have these configs as this is such a common issue. The documentation needs improvement as it is challenging to use this plugin.

Credit to @mauricedoepke #50

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

    new WebpackObfuscator(
        {
          rotateStringArray: true,
        },
        ['**/vendor.*.chunk.js'] // pattern for the vendor chunk file generated where * is the hash
      )
    );