Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UglifyJS minifying fails on some advanced scripting examples #8186

Closed
GameSoul7Eugene opened this issue Aug 21, 2024 · 3 comments
Closed

UglifyJS minifying fails on some advanced scripting examples #8186

GameSoul7Eugene opened this issue Aug 21, 2024 · 3 comments
Assignees
Labels

Comments

@GameSoul7Eugene
Copy link

Problem description

If you export the following scripting examples to HTML5 with UglifyJS, they will fail to launch in the browser after exporting (although there will be no errors when exporting and minifying in C3). None of them break in the Bundle only minify mode.

Complex Terrain [breaks in Simple and Advanced minify modes]
Integrated 3D engine [breaks only in Advanced minify mode]
Snowboard 3D [breaks in Simple and Advanced minify modes]

Observed result

Complex Terrain

Simple
complexTerrain-simple

Advanced
complexTerrain-advanced

Snowboard 3D

Simple
snowboard3D-simple

Advanced
snowboard3D-advanced

Integrated 3D engine

Advanced
integrated3DEngine-advanced

Expected result

These projects have no errors after exporting, no matter what minify mode they used!

More details

Affected browsers/platforms: any

First affected release: r403 as it was the first release to add the UglifyJS minifier.

System details

View details

Platform information

Product: Construct 3 r403 (beta)
Browser: Firefox 129.0
Browser engine: Gecko
Context: browser
Operating system: Windows 10
Device type: desktop
Device pixel ratio: 1
Logical CPU cores: 8
Approx. device memory: (unavailable)
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Language setting: en-US
Local storage

Storage quota (approx): 10 gb
Storage usage (approx): 45 mb (0.4%)
Persistant storage: No
Browser support notes

This list contains missing features that are not required, but could improve performance or user experience if supported.

Rendering multiple on-screen Layout Views is slow in Firefox due to [bug 1163426](https://bugzilla.mozilla.org/show_bug.cgi?id=1163426)
Determining input device capabilities is not supported.

WebGL information

Version string: WebGL 2.0
Numeric version: 2
Supports NPOT textures: yes
Supports GPU profiling: no
Supports highp precision: yes
Vendor: Google Inc. (Intel)
Renderer: ANGLE (Intel, Intel(R) HD Graphics Direct3D11 vs_5_0 ps_5_0), or similar
Major performance caveat: no
Maximum texture size: 16384
Point size range: 1 to 1024
Extensions:

EXT_color_buffer_float
EXT_float_blend
EXT_texture_compression_bptc
EXT_texture_compression_rgtc
EXT_texture_filter_anisotropic
OES_draw_buffers_indexed
OES_texture_float_linear
OVR_multiview2
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_lose_context
WEBGL_provoking_vertex

Audio information

System sample rate: 48000 Hz
Output channels: 2
Output interpretation: speakers
Supported decode formats:

WebM Opus (audio/webm;codecs=opus)
WebM Vorbis (audio/webm;codecs=vorbis)
MPEG-4 Opus (audio/mp4;codecs=opus)
MPEG-4 AAC (audio/mp4;codecs=mp4a.40.2)
MP3 (audio/mpeg)
FLAC (audio/flac)
PCM WAV (audio/wav;codecs=1)

Supported encode formats:

WebM Opus (audio/webm;codecs=opus)

Video information

Supported decode formats:

WebM AV1 (video/webm;codecs=av01.0.00M.08)
WebM VP9 (video/webm;codecs=vp9)
WebM VP8 (video/webm;codecs=vp8)
MPEG-4 AV1 (video/mp4;codecs=av01.0.00M.08)
MPEG-4 VP9 (video/mp4;codecs=vp9)
MPEG-4 H.264 (video/mp4;codecs=avc1.420034)

Supported encode formats:

WebM VP8 (video/webm;codecs=vp8)
@AshleyScirra AshleyScirra self-assigned this Aug 22, 2024
@AshleyScirra
Copy link
Member

I think the issues with simple mode come down to a bug in UglifyJS - I've reported it to them here: mishoo/UglifyJS#5927
That will be followed up there.

As for the Integrated 3D engine example, that doesn't work after an advanced minify export with Closure Compiler either. I suspect that's just because it bundles a significant part of the three.js engine, and that the library has not been written to comply with the restrictions of advanced mode minification (e.g. mixing string and dot property syntax). To fix that you'd likely need to follow up with the three.js project.

@AshleyScirra
Copy link
Member

FWIW I debugged three.js a bit and identified it indeed is not written to support advanced minification, and I submitted a feature request describing the problem and how to fix it.

@AshleyScirra
Copy link
Member

FWIW I also identified the setting in UglifyJS that causes the bug with simple minified exports, and disabled it on the server-side, so UglifyJS exports should now work with the other samples (not using three.js) in simple or advanced minify mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants