cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
232 stars 42 forks source link

Optimize bundles #251

Open lgarron opened 1 year ago

lgarron commented 1 year ago

Right now, we use esbuild with --bundle --splitting, which is quite good at enabling a page to load only the code that it needs. For example:


This allows the following page to load using only 106kB transferred over the internet[^1]: https://alpha.twizzle.net/edit/?puzzle=clock&alg=UR1%2B+DR4-+DL4%2B+UL3-+U2%2B+R4%2B+D3-+L2-+ALL2-+y2+U1%2B+R5%2B+D4-+L2%2B+ALL3%2B+UR And puzzles with 3D visualization load in ≈266kB[^1].

[^1]: Ignoring the Ubuntu font, which is 301kB on its own but can load slowly and separately, and is not needed for page functionality.

This is quite good! It's significantly smaller than even a single puzzle screenshot would be, in a lot of cases.


However, there are some issues, like: