Obfuscating Code.js Files Breaks The Code (Why?)

If I try to obfuscate the code (merely remove paragraphing, spacing, indentation) the code is glitchy or just no longer works

Why is that, shouldn’t the code run regardless of formatting?

We cannot tell you because we have no idea what your obfuscator does to break code

I’m not using an “obfuscator”, I’m just using an online text tool that removes spaces, paragraphs and line breaks

I decided to just compact the code to make it less readable

Why would that affect the code?, I’ve never seen code become broken by removing “readable formatting”

Well obviously your tool (which sounds like closure compiler) is doing more else it would not break.

So you’re saying if I manually removed the spaces and lines the same thing wouldn’t happen?

I guess I’ll try that, and no I’m not using closure compiler, I’m using a simple online text manipulation tool

But I guess maybe it is doing something extra I suppose, I have a desktop software that can do the same, guess I’ll try it and see if I get the same problem

If so I give up, if someone clones my app so be it, this shouldn’t be this complicated lol

In the code generated there is name used for your objects, textures, sound etc…
When you use the obfuscator these name are changed and break your game.

I didn’t change any names, all I did was remove spaces, new lines and indentations

I stopped using the obfuscator and decided I should just compact the code to make it less readable

The game still breaks

Now the obfuscator for cordova (the plugin) does work, but it doesn’t change in game variable names, it changes the variable names for things like “java.lang.Object postMessage(java.lang.String,java.lang.Object)” into “postMessage” or other variables into letters like ‘a’ or ‘b’

But it does not change in game variable names like “Health”, I don’t know how to get it to obfuscate in game variables, the Cordova plugin works, but I don’t know how to configure it to change the game variables rather than miscellaneous code variables

I’m just going to use the Cordova plugin and forget about it though, its obfuscating something so some security is better than nothing

Thanks anyways @arthuro555

Maybe one day someone will make a thread about how to do this

If I were to ask for a feature, it would be a feature in Gdevelop to store a list of your variables (even Global Variables) and have Gdevelop go through the list and replace all the variables in your project with random character variables like “AaBbbZs” so in your final export your code is obfuscated and hard to understand

An sprite object is define like this:
gdjs.LevelCode.GDExplosionObjects1= [];
In logic the obfuscator rework this name so everything is broken.

So everything has to be defined on a new line?