HTML5 Build Size Optimization

I saw this thread the other day. Hope it helps!

I have tried lowering the final shipping build size for Tappy Chicken by enabling and disabling options in UE4Game.Target.cs SetupGlobalEnvironment, wrapped up inside a conditional statement that checks if the target platform is iOS. I have uncommented the conditional statement to enable these options regardless of the target platform we are on as follows:

    //if (Target.Platform == UnrealTargetPlatform.IOS)
		// to make World Explorers as small as possible we excluded some items from the engine.
		// uncomment below to make a smaller iOS build
        UEBuildConfiguration.bCompileRecast = false;
        UEBuildConfiguration.bCompileSpeedTree = false;
        UEBuildConfiguration.bCompileAPEX = false;
        UEBuildConfiguration.bCompileLeanAndMeanUE = true;
        UEBuildConfiguration.bCompilePhysXVehicle = false;
        UEBuildConfiguration.bCompileFreeType = false;
        UEBuildConfiguration.bCompileForSize = true;

But for some reason the final build size gets only lowered down to around 63MB and doesn’t seem to minify .js file, which I think it should when bCompileFoSize is enabled. Is there any extra steps that I should take for that to happen? Or is there any other suggestions to lower build size even further down?

You could e.g disable Slate in your UE4Game.Target.cs if you don’t need it (see docs). See this question on what you also can try to minimize the size, although unfortunately there is no answer to this question yet. TappyChicken for iOS is around 43.8 MB in size.

Check the Ouput Log window for emscripten commands during packaging. If bCompileForSize is used, the output must include somthing like

/path/to/emscripten/version/emcc ... -Oz -s ASM_JS=1 ...

as specified in the HTML5ToolChain.cs