I decided to investigate the bundle size for misode.github.io and was quite shocked. After code splitting and tree shaking I managed to get the total JS output size from 5.22MB down to 3.95MB, and the main entrypoint from 4.53MB down to 703KB.
The initial bundle was 5.22MB, with the main chunk 4.53MB (the red part). The only chunks split up were the different languages localizations.
One of the first things I noticed was that highlight.js included a bunch of languages, while I'm only using JSON. This eliminated 1.35MB.
Most visitors will only need one version of mcschema. Each version is about 200KB large. With those split off, the main chunk was reduced from 3.17MB to 2MB.
The next library is brace, which is the JSON text editor. This is quite a large library: 742KB. While it's used on every generator page (when highlighting is enabled), I decided to split it anyways.
Deepslate is the library used for the worldgen visualizers. Evidently it's only used on those generator pages and when the visualizer is active.
However the deepslate imports are intertwined with the website code, so splitting would not be easy. Instead I decided to split off the duplicate version of deepslate for 1.18 (before 1.18.2), which is 300KB.
This is a library only used when an error is detected and I want the stacktrace remapped to create a link to github issues. This only needs to be loaded once an error appears.
The generator allows pasting JSON with comments. For this I use comment-json, which again is quite a large library: 400KB.