Interesting that it is written in Pascal:
https://github.com/castle-engine/castle-engine
The minimal demos are still surprisingly big though (same ballpark as Unity web builds for similar simple demos).
For a language without runtime I would expect a couple hundred kilobytes at most for those simple demos (but the download is 6.4 MB compressed and decompresses to 43 MByte, and takes significant time after the download is finished to start). Would be interesting to figure out why dead code doesn't seem to be removed by the compiler (e.g. is it because of the engine design, or because the Pascal-to-WASM compiler doesn't support dead code elimination). Also why is the compressed to uncompressed ratio so big, there seems to be a lot of duplicate code or data in those WASM files.
Pascal can definitely produce small binaries (and it looks like it does dead code elimination, under the name “smartlinking” [0]), so it may be a limitation of the WASM backend like you said or not enabled for some reason.
[0]: https://www.freepascal.org/docs-html/user/userse13.html
Object Pascal has a substantial runtime library called RTL: https://en.m.wikipedia.org/wiki/Free_Pascal_Runtime_Library
Also per azakai in another thread, wasm-opt shrinks this binary to 14 MB. Still a lot.