javascript-obfuscator / javascript-obfuscator

A powerful obfuscator for JavaScript and Node.js
https://obfuscator.io
BSD 2-Clause "Simplified" License
13.51k stars 1.48k forks source link

3.0.0 and above break code that works with 2.13 to 2.19 versions. #1157

Open Nantris opened 1 year ago

Nantris commented 1 year ago

Expected Behavior

Upgrading from 2.x to 3.x should "just work" after updating the relevant option names

Current Behavior

3.0.0 and all builds I've tried above that result in: Error: Cannot find module 'yargs-parser'

Steps to Reproduce

  1. Unknown

Your Environment

Stack trace

    at t (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1047713)
    at 83356 (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:895678)
    at u (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1142257)
    at 390 (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:900842)
    at u (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1142257)
    at /tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:874357
    at u.a (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1142784)
    at 93607 (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:874207)
    at u (/tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1142257)
    at /tmp/.mount_AppDsOGW4/resources/app.asar/app/dist/preload.build.js:2:1144138

Minimal working example that will help to reproduce issue

Apparently merely importing yargs-parser, though I am not yet certain.

Additional notes

We're applying the obfuscation using webpack-obfuscator rather than calling javascript-obfuscator directly. I tested versions 4, 3, and 2.13 to 2.19. The 2.x versions work, but nothing above.

relative commented 1 year ago

Is the yargs-parser module being bundled into your preload.build.js?

Nantris commented 1 year ago

Yes it is (and previously worked fine with the same yargs-parser version.)

softworkz commented 1 year ago

Possibly a duplicate of (https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1093). See this comment: https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1093#issuecomment-1613908105