vite.config.js splits geotiff and shpjs out so they load only when a user opens
a Cloud-Optimized GeoTIFF or imports a shapefile, but the built index.html
preloaded both on every visit — about 428 kB (152 kB gzipped) nobody had asked
for.
Two separate causes, both visible in the entry chunk's first line:
- it imported Vite's preload helper, used by every dynamic import(), from the
geotiff chunk. The helper is a virtual module with no node_modules path, so
Rollup had parked it there; needing it at startup dragged the whole chunk in.
It now has a chunk of its own, about 1 kB.
- it imported JSZip from the shpjs chunk. JSZip reached the bundle through
shp-write, which gis-export.js imports for Shapefile export, so it is needed
at startup whatever happens; filing it under shpjs pulled that chunk in too.
It is now its own chunk, costing the 31 kB it actually is.
dist/ rebuilt: index.html now preloads vite-helpers and jszip instead.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>