1
votes

I'm using Node / React / Webpack with leaflet. I installed leaflet using npm and in my map component I import 'leaflet'; which works fine for the js.

However, the map does not look correct due to the css not working correctly, however images stored in the leaflet/dist/images seem to work fine. In order to get the css to work I have to also import 'leaflet/dist/leaflet.css' but it feels to me like I shouldn't have to and that it should be included with the first import statement?

1
Yes you have to have, see this link might be useful: leaflet-css webpack requireZeeshan Hassan Memon
When I miss the CSS, I get a crazy tiled set that is all in the wrong order and draggable in a weird way; if you seem to end up with that then you are missing the CSS. So yep def need it:)tempranova

1 Answers

3
votes

Yes you have to have, see this link might be useful:

leaflet-css webpack require

I omitted its css in an ionic project but coppied a few necessary lines to avoid broken map ui.