rollup-obfuscator icon indicating copy to clipboard operation
rollup-obfuscator copied to clipboard

Obfuscate misses out some modules to obfuscate

Open VijayaSankarN opened this issue 1 year ago • 2 comments

I have to obfuscate 7173 modules (application in ReactJS CoreUI framework). With this configuration:

plugins: [
  react(),
  obfuscator({
    compact: false,
    numbersToExpressions: true,
    identifierNamesGenerator: 'hexadecimal',
    selfDefending: true,
    renameGlobals: true,
  }),
]

All modueles are processed. But any other options added to the above config, like deadCodeInjection or splitStrings or stringArray or any other options from https://www.npmjs.com/package/javascript-obfuscator, the number of modules being processed are getting reduced to anything less than 6000 randomly and then build ends without any errors. This prevents the execution of the application overall.

What is being missed or is there anything that I need to configure in vite or obfuscator configuration to always ensure that 7173 modules are being executed.

I even tried adding space size:

{
  "scripts": {
    "build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' vite build"
  }
}

Adding this further affects the number of modules being processed to anywhere between 2000 and 3000. Adjusting the values are of no help.

Without this Obfuscate configuration vite build always builds all the modules successfully.

VijayaSankarN avatar Jul 29 '24 09:07 VijayaSankarN

Same question.

After using this plugin:

vite v3.2.10 building for production...
✓ 201 modules transformed.

Not using this plugin:

vite v3.2.10 building for production...
✓ 326 modules transformed.

Iceberry-qdd avatar Aug 16 '24 03:08 Iceberry-qdd

Oh, finally i solve this by change option ignoreImports from false to true. Guess you can add this option to solve it too.

plugins: [
  react(),
  obfuscator({
    compact: false,
    numbersToExpressions: true,
    identifierNamesGenerator: 'hexadecimal',
    selfDefending: true,
    renameGlobals: true,
    ignoreImports: true // Add this
  }),
]

Iceberry-qdd avatar Aug 16 '24 12:08 Iceberry-qdd