Html build packaging broken for shipping builds
The files for the packaged html builds are being named incorrectly when they're compressed. For example jsgz instead of js.gz. It's also not using the correct template, it uses templateX instead of the template for the compressed files. I've tried changing everything manually, but somewhere it calls for the data file and I can't find where to change it to the compressed type.
asked May 06 '16 at 08:47 PM in Bug Reports
Is there some option in the UE4 editor to switch to utilizing the precompressed files? If so, I haven't used that, but I do routinely host precompressed files of UE4 exports. What I do is just export as usual, and then modify the .html file as follows.
First, find the definition of Module.locateFile() in the generated .html file:
and edit that to the form
Then find all references to the URLs in the html page, and replace them to route through the Module.locateFile function. For example:
After that, if the page is loaded via a http:// or https:// URL, it will fetch the .jsgz, .datagz and .symbolsgz files. However if the files are uploaded to a CDN, e.g. S3, it won't work by default, since the web servers will incorrectly autodetect the mime type the content. For it to work, the CDN will need to be configured to add the following header rules for the gz-ending files:
.jsgz files need
and .datagz, .symbolsgz and .memgz files need
If you'd prefer using suffixes .js.gz instead of .jsgz and so on, that works as well, as long as the above headers are configured for the web server, and Module.locateFile() is set to append ".gz" suffix instead of only the "gz" suffix.
You'll see that the above changes don't change the loading of the .data and the .mem files anywhere, but it seems to magically work for those files as well. The reason for that is that the Module.locateFile() is actually an Emscripten runtime function that the Emscripten loader calls for these files when it is loading them up, see Module.locateFile documentation and occurrences of Module.locateFile in Emscripten runtime.
This setup works for UE 4.11.2, I think 4.10 and older generated a different looking .html output, so for those the changes would be somewhat different.
If there is some UE4 provided checkbox for enabling compression, I wasn't aware of that, which is why I developed this manual configuration :| Of course any bugs on that method should be addressed by the developers.
answered May 07 '16 at 09:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here