perf: shrink map marker payload and extend vendor chunking
C (marker): Reuse the existing ~24 KB logo.png for the "you are here" map marker instead of the 2.9 MB user-location.png (byte-identical copy of logo-sticker). Removed the unused 2.9 MB PNG from public/images, cutting deploy/APK size. Same artwork, ~99% smaller payload. B (chunking): Extend the existing manualChunks in vite.config.ts to split the largest page-specific libraries into their own vendor chunks (hls.js, html5-qrcode, recharts) so they load only on the routes that use them. Capacitor single-bundle branch and React core grouping left untouched. Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
46cb2266ea
commit
358708ee27
3 changed files with 17 additions and 1 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 MiB |
|
|
@ -191,7 +191,9 @@ const createShopIcon = () => L.divIcon({
|
|||
// with a pulsing accuracy halo (Google-Maps-style, brand-flavored).
|
||||
const createUserLocationIcon = () => {
|
||||
// BASE_URL resolves correctly for both web ('/') and the Capacitor APK ('./').
|
||||
const logoUrl = `${import.meta.env.BASE_URL}images/user-location.png`;
|
||||
// Reuse the small (~24 KB) brand logo for the marker instead of the old
|
||||
// 2.9 MB user-location.png — same artwork, ~99% smaller payload.
|
||||
const logoUrl = `${import.meta.env.BASE_URL}images/logo.png`;
|
||||
return L.divIcon({
|
||||
className: 'user-location-marker',
|
||||
html: `
|
||||
|
|
|
|||
|
|
@ -92,6 +92,20 @@ export default defineConfig(() => ({
|
|||
if (id.includes('leaflet') || id.includes('ngeohash')) {
|
||||
return 'vendor-map';
|
||||
}
|
||||
// Media — hls.js is large (~500KB) and only used by the radio/video
|
||||
// players. Split it so the map homepage never downloads it.
|
||||
if (id.includes('hls.js')) {
|
||||
return 'vendor-media';
|
||||
}
|
||||
// QR scanning — html5-qrcode (~300KB) is only used in wallet/scan
|
||||
// flows; keep it out of the initial payload.
|
||||
if (id.includes('html5-qrcode') || id.includes('qrcode')) {
|
||||
return 'vendor-qr';
|
||||
}
|
||||
// Charts — recharts (~400KB) is only used on stats pages.
|
||||
if (id.includes('recharts') || id.includes('d3-')) {
|
||||
return 'vendor-charts';
|
||||
}
|
||||
// Nostr core — changes infrequently, worth caching separately
|
||||
if (id.includes('nostr-tools') || id.includes('@nostrify') || id.includes('@noble')) {
|
||||
return 'vendor-nostr';
|
||||
|
|
|
|||
Loading…
Reference in a new issue