title: How do I reduce the bundle size of React Leaflet?
body: <p>I have a Gatsby.js project where the parsed size of my bundle is 3.92 MB. <strong>1.1 MB</strong> of that is <code>leaflet-src.js</code>. Leaflet also seems to supply <code>leaflet.js</code> which is only 508 KB. After reading <a href="https://github.com/Leaflet/Leaflet/issues/5288#issuecomment-279397985" rel="nofollow noreferrer">this issue</a>, whenever I import Leaflet, I always import this smaller version, like so:</p>
  <pre class="lang-js prettyprint-override"><code>import L from &quot;leaflet/dist/leaflet&quot;
  </code></pre>
  <p>Regardless, whenever I run Webpack Bundle Analyzer, both <code>leaflet-src.js</code> and <code>leaflet.js</code> are imported:
  <a href="https://i.stack.imgur.com/y4UO5.png" rel="nofollow noreferrer">Webpack Bundle Analyzer Result</a></p>
  <p>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.</p>
  <p>Any help would be very much appreciated.</p>