cocos-engine
cocos-engine copied to clipboard
use const enum type in engine to reduce engine size
Need to confirm whether there is any use of value to reverse query the key of the enum object in the engine, if not, we can consider changing the entire amount to const enum
I don't quite understand this issue. It seems like a coding style issue. May modify all engine codes.
@minggo on the left of captured image is the source code of ts, and the right one is the compiled output
while we use const enum, the output js is of much more smaller package size.
It's not the matter of coding style but the engine size.
But I found that const enum will be optimized like the above.
I think the enums in the internal modules could use const enums safely while the public enum should not since it will break the compatibility. Yes, const enum will may package size smaller. Perhaps, we need a switch to open/close this feature.