smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

Cannot find module leaflet-geosearch! :( #104

Closed enocholumide closed 7 years ago

enocholumide commented 7 years ago

I installed via npm, but my map reload was prevented saying can not find module.. dont know what is wrong: please help

image

smeijer commented 7 years ago

You can fix your problem by not including from the lib folder, but using a default import instead.

import { GeoSearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';

const provider = new OpenStreetMapProvider();

const searchControl = new GeoSearchControl({
  provider: provider,
});

const map = new L.Map('map');
map.addControl(searchControl);

Please check the readme and the provided snippets in the demo: http://smeijer.github.io/leaflet-geosearch