mapbox / mapbox-gl-compare

Swipe and sync between two maps
ISC License
147 stars 42 forks source link

mapbox_gl__WEBPACK_IMPORTED_MODULE_1___default.a.Compare is not a constructor #46

Open EyadAyman658 opened 2 years ago

EyadAyman658 commented 2 years ago

something is wrong with with mapbox-gl-compare library even though I was trying the example that was mentioned in the docs , any solution for this bug ?

Thanks :)

owolfy commented 2 years ago

I installed the library with npm. What did the trick for me was using the library directly.

import * as mapboxCompare from 'mapbox-gl-compare'; const map = new mapboxCompare(beforeMap, afterMap, container, {});

alexandis commented 2 years ago

I have similar issue with another class. And the described trick does not help:

import * as MapboxDrawer from '@mapbox/mapbox-gl-draw';
...
this.mapBoxDraw = new MapboxDrawer(...);

image

The functionality mentioned above is situated inside Angular library which is consumed by Angular app.

owolfy commented 2 years ago

@alexandis have you tried to change the definitions in tsconfig.json ?

alexandis commented 2 years ago

@alexandis have you tried to change the definitions in tsconfig.json ?

I've already found my problem: I've installed @types/mapbox__mapbox-gl-draw manually and tried to reference MapboxDraw from there...

samYnsat commented 1 year ago

Hello, I am still facing the same problem with Angular. I tried all of the above, but I have the same error. mapbox_gl_compare__WEBPACK_IMPORTED_MODULE_3___default(...) is not a constructor I don't know what else to do because there is no a types version with index.d.ts Thank you

uzma-nazim commented 1 year ago

i am also facing when i select suggestion on Geocoder I got this error can anyone tell me solution TypeError: react_map_gl__WEBPACK_IMPORTED_MODULE_2__.FlyToInterpolator is not a constructor

juanpablogd commented 11 months ago

Hello, I am still facing the same problem with Angular. I tried all of the above, but I have the same error. mapbox_gl_compare__WEBPACK_IMPORTED_MODULE_3___default(...) is not a constructor I don't know what else to do because there is no a types version with index.d.ts Thank you

Did you resolved it?