Uglify game scripts on export?

When exporting the zip file with concatenate scripts enabled I see everything pretty much untouched…

I recommend:

  • Stripping debugger calls
  • Removing comments
  • Optimize & Uglify
  • Inline the entire file

Is it possible to do this via the editor?

Not at the moment, no. It’s certainly something that we can do but there hasn’t been much demand for it yet.

This is something I’d personally like to see added as well. :slight_smile:

I’d love to have these options:

  • Remove comments
  • Remove console.logs
  • Uglify the scripts
  • Lock the build to a specific domain name

I know all of these are possible with external tools, but having it built into the editor when exporting a build would be a great time saver!

At the moment, the Editor does do the following on publish:

  • remove comments
  • inline (single line of code)
  • minify (variable names minified)
2 Likes

But it doesn’t do that when exporting the ZIP with concatenate scripts enabled right?

Even those 3 things would be time savers, but they need to be available when exporting a ZIP file!

I believe the guys are now moving to Parcel application bundler, which will enable them to add those and other features to the builder.

1 Like

Just did a test export build zip and it does it for me.

If it doesn’t do it for you, can you give a sample of the output or the project/file for me to take a quick look at?

The file __game-scripts.js contains all scripts without minification one after the other, separated by comments with the file name:

// levelAnnouncer.js
readable code …
// other.js
readable code …

No comments stripped, no inlining

I’m doing web downloads with these options:

chrome_auRlNKPn73

Let me double check on a new user account, I wonder if things are different on a super user :thinking:

Yes, I think it should be without minification for now. I believe it was enabled some time ago, but it was disabled due to reasons (dragons). On top of that the UI was missing a hint that the minification takes place. I believe the current way is a proper one, following the UI.

Sorry, I can’t replicate this issue @dbhvk. New account with Personal plan gives me the following

Can you share the project with me please (yaustar) as I would like to see if it’s user/account/project specific :thinking:

Shared!

1 Like

Thanks for that, that really helps!

Turns out that the use of any ES6 syntax stops the stripping and minification of that script.

Changing

setTimeout(() => {});

to

setTimeout(function() {});

‘Fixes’ the issue.

I will check with team if there’s anything we can do about that as I don’t feel like that is a good reason not to minify.

2 Likes