mapbox / mapbox/mapbox-gl-compare

Issues using ES6

Open
#1 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
152
Forks
43
PR merge metrics
No merged PRs in 30d

Description

@tristen I'm trying to use your mapbox-gl-compare tool using ES6.

Would be really nice if the end result would something like this:

import mapboxgl from 'mapbox-gl'
import Compare from 'mapbox-gl-compare'

// before & after Map objects //

mapboxgl.Compare(before, after)

Uncaught ReferenceError: mapboxgl is not defined | index.js:5

However, the end result looks like this "hack" looking code.

import mapboxgl from 'mapbox-gl'
window.mapboxgl = mapboxgl
import Compare from 'mapbox-gl-compare'

// before & after Map objects //

mapboxgl.Compare = Compare
mapboxgl.Compare(before, after)

Even after doing that, I'm still catching some errors.

Uncaught TypeError: this._setPosition is not a function | index.js:20

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ES6 entry point referenced as index.js and reproduce the reported import usage and errors. Check why mapboxgl is unavailable and why this._setPosition is missing; done means the documented import-based setup works without assigning globals and both reported errors are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.