zakjan / mapbox-gl-draw-geodesic

Geodesic plugin for Mapbox GL Draw
https://zakjan.github.io/mapbox-gl-draw-geodesic/
MIT License
51 stars 8 forks source link

import fails on Quasar webpack project #3

Closed jaybo closed 4 years ago

jaybo commented 4 years ago

I'm unable to import either MapboxDrawGeodesic or MapboxDrawWaypoint into a Quasar project which uses the webpack bundler.

yarn add mapbox-gl-draw-geodesic
// seems to install fine, all files are in the correct node_modules directory, but then...

import MapboxDraw from "@mapbox/mapbox-gl-draw";  // works fine
import MapboxDrawGeodesic from "mapbox-gl-draw-geodesic"; // fails
console.log(MapboxDrawGeodesic);

gives 'undefined'.

Is there an additional build step required if I'm not using rollup? (Hmm... I'm also using D3 and turf which also build with rollup without any problem).

Partial output from ' yarn list': ├─ mapbox-gl-draw-geodesic@2.0.0 │ ├─ arc@^0.1.1 │ ├─ circle-to-polygon@^2.0.2 │ ├─ hat@0.0.3 │ └─ haversine-js@^1.0.0 ├─ mapbox-gl-draw-waypoint@1.0.2 ├─ mapbox-gl@1.11.1 │ ├─ @mapbox/geojson-rewind@^0.5.0 │ ├─ @mapbox/geojson-types@^1.0.2 │ ├─ @mapbox/jsonlint-lines-primitives@^2.0.2 │ ├─ @mapbox/mapbox-gl-supported@^1.5.0 │ ├─ @mapbox/point-geometry@^0.1.0 │ ├─ @mapbox/tiny-sdf@^1.1.1 │ ├─ @mapbox/unitbezier@^0.0.0 │ ├─ @mapbox/vector-tile@^1.3.1 │ ├─ @mapbox/whoots-js@^3.1.0 │ ├─ csscolorparser@~1.0.3 │ ├─ earcut@^2.2.2 │ ├─ geojson-vt@^3.2.1 │ ├─ gl-matrix@^3.2.1 │ ├─ grid-index@^1.1.0 │ ├─ minimist@^1.2.5 │ ├─ murmurhash-js@^1.0.0 │ ├─ pbf@^3.2.1 │ ├─ potpack@^1.0.1 │ ├─ quickselect@^2.0.0 │ ├─ rw@^1.3.3 │ ├─ supercluster@^7.1.0 │ ├─ tinyqueue@^2.0.3 │ └─ vt-pbf@^3.1.1

zakjan commented 4 years ago

Hi, I created a clean project with Quasar, and importing works for me with:

import * as MapboxDrawGeodesic from "mapbox-gl-draw-geodesic"

Could you try it?

jaybo commented 4 years ago

Ah, yes, that works! Thank you for this lovely project!

zakjan commented 4 years ago

Thanks! This might actually be the default way to import this library, I'll update the readme.