perf: load pages on demand, split vendor chunks, and replace the 888 KB favicon
App.tsx imported all 24 pages statically, so a first-time visitor downloaded the admin panel, three multiplayer modes and the preset-pair table before the landing page could render - one 682 KB chunk. Every page except Home is now React.lazy behind a Suspense boundary: 56 chunks, pages at 2-11 KB. Verified in a browser against the production build - the landing page fetches only the app and vendor chunks, a navigation fetches that route's chunks and renders, and a deep link into an authenticated route lazy-loads it, redirects to sign-in, and lazy-loads that too. Vendor code is split into vendor-react, vendor-router, vendor-ui and vendor-net via manualChunks. The main chunk was 95% dependencies, so the first load is not much smaller - the dependency set is the load - but the chunk that changes on every deploy is now 50 KB (14 KB gzipped) rather than 682 KB. A returning visitor after a deploy re-downloads the app, not React. The favicon was 888 KB: PNG data under a .jpg name, 768x768, with a fully opaque alpha channel, fetched on every page load. It is a 2.6 KB 32px PNG now, with a 180px apple-touch-icon, and manifest.json points at real 192px and 512px PNGs with the correct type instead of declaring the same mislabelled file at both sizes. The service worker's notification icon pointed at a /favicon.ico that never existed. The useGameStore selector item from M26 was already done in WP-10. Addresses M26.
This commit is contained in:
1 parent
2bdbf5fbc3
commit
e67692006f
13 files changed
+184
-63
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Reference in new issue
Block a user