protomaps / basemaps

Basemap PMTiles generation and cartographic styles for OpenStreetMap data and more
https://maps.protomaps.com/
Other
347 stars 44 forks source link

export 'default' (imported as 'layers') was not found in 'protomaps-themes-base' (module has no exports) #236

Closed devinmarkley closed 5 months ago

devinmarkley commented 5 months ago

Required information

export default function MaplibreViewer() { useEffect(() => { let protocol = new Protocol(); maplibregl.addProtocol("pmtiles", protocol.tile); return () => { maplibregl.removeProtocol("pmtiles"); }; }, []);

return (

Protomaps © OpenStreetMap', }, }, layers: layers("protomaps", "light"), }} mapLib={maplibregl} />

); }`

Problem:

export 'default' (imported as 'layers') was not found in 'protomaps-themes-base' (module has no exports)

Any help would be greatly appreciated.

Thanks

bdon commented 5 months ago

protomaps-themes-base: 1.22.19

please use version 2.0.0-alpha.6

devinmarkley commented 5 months ago

Just updated to the most recent version and I'm getting the same issue.

export 'layers' (imported as 'layers') was not found in 'protomaps-themes-base' (module has no exports)

Code:

import { useEffect } from "react"; import Map from "react-map-gl"; import maplibregl from "maplibre-gl"; import "maplibre-gl/dist/maplibre-gl.css"; import { Protocol } from "pmtiles"; import { layers } from 'protomaps-themes-base';

export default function MaplibreViewer() { useEffect(() => { let protocol = new Protocol(); maplibregl.addProtocol("pmtiles", protocol.tile); return () => { maplibregl.removeProtocol("pmtiles"); }; }, []);

return (

Hello World

Protomaps © OpenStreetMap' } }, layers: layers("protomaps","light") }} mapLib={maplibregl} />

); }

bdon commented 5 months ago

Can you please try protomaps-themes-base@2.0.0 and push a minimal repo to reproduce the above steps including package.json and build tool / step?

devinmarkley commented 5 months ago

Thanks for working with me on this I really appreciate it.

Moving from 2.0.0-alpha.6 to simply ^2.0.0 seems to some my issues with the module having no exports. However while I no longer get this error with this change the map still doesn't get styled correctly. I have linked a minimal repo with the package.json below.

link

bdon commented 5 months ago

you are missing the glyphs key in your style as the console error shows, see https://docs.protomaps.com/basemaps/maplibre

Screenshot 2024-04-20 at 10 01 40