An Example of Drawing a Map with Svelte + Leaflet
-
You need to place the
map
's initialization in theonMount
hook to ensure thatLeaflet
is rendered on the client side, not the server side. -
Also, you need to import the
leaflet/dist/leaflet.css
file and specify the element'sheight
in the<style>
block in order for the map to display correctly.