I have a Gatsby.js project where the parsed size of my bundle is 3.92 MB. 1.1 MB of that is leaflet-src.js
. Leaflet also seems to supply leaflet.js
which is only 508 KB. After reading this issue, whenever I import Leaflet, I always import this smaller version, like so:
import L from "leaflet/dist/leaflet"
Regardless, whenever I run Webpack Bundle Analyzer, both leaflet-src.js
and leaflet.js
are imported:
Webpack Bundle Analyzer Result
It seems like the GitHub issue I mentioned was hinting at configuring webpack to use the optimized version, but I'm really struggling to figure out how to do that exactly.
Any help would be very much appreciated.