0

I'm getting _maplibreGl.default.Compare is not a constructor error always when I try to compare two maps.

part of code:

  var beforeMap = L.maplibreGL({
      container: "before",
      style: "https://demotiles.maplibre.org/style.json",
      center: [7.221275, 50.326111],
      zoom: 5
    }).addTo(mapRef.current);

    var afterMap = L.maplibreGL({
      container: "after",
      style:
        "https://vectortiles.geo.admin.ch/styles/ch.swisstopo.leichte-basiskarte.vt/style.json",
      center: [7.221275, 50.326111],
      zoom: 5
    }).addTo(mapRef.current);

    // A selector or reference to HTML element
    var container = "#comparison-container";
    var map = new maplibregl.Compare(beforeMap, afterMap, container);

I'm using below versions:

"@maplibre/maplibre-gl-compare": "0.5.0",
"@maplibre/maplibre-gl-leaflet": "0.0.19",
"leaflet": "1.9.3",
"maplibre-gl": "1.15.3"

Any solution?

I'm expecting possible solution that related to the maplibre-gl library.

toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • I solved it. Please refer to my solution to my question on the forum https://github.com/maplibre/maplibre-gl-compare/issues/31#issuecomment-1675981168 – piruthivi raj Aug 12 '23 at 16:09

0 Answers0