I am looking for a way to obfuscate / compress my javascript code.
I have already searched the OS and the web, but there are many outdated or broken tutorials and scripts. Also, honestly, I don't have the time to test them all to find the few that still work in 2021 with JS ES6.
I am using code like this:
balance = await provider.getBalance(accountSigner);
...
const networkWallet = await provider.getNetwork();
but I see other websites having this code:
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2]...
I want to make it harder to copy and reuse my JS code, I know making it 100% irreversible is impossible but at least it will take enough time to do that it won't be worth it.
Some of my tries:
- uglifyjs -c test.js -> it's always running for a 5 lines file, without using enough cpu - I don't hear almost anything working in the case, so I think that it doesn't work. Without -c it's immediate) (the same with sudo)
- closure-compiler.appspot.com: it fails also for their suggested file, it's too slow and outdated
- http://jsutility.pjoneil.net/ - it doesn't support
provider.on("network", (newNetwork, oldNetwork) => { - https://jscompress.com/ - it seems to work but it only performs little compression/obfuscation with no options to obfuscate e.g. strings
- https://javascriptobfuscator.com/Javascript-Obfuscator.aspx - the most useful options are only available in the GUI for windows
I'm using Ubuntu LTS.
I can also use PHP if it can help.