[Bug] Mapbox geocoder example crashes: "i is not a function"
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- node.js, react, typescript, webpack
Research direction
Start with the website's webpack configuration and how it resolves the nested nanoid dependency used by @mapbox/mapbox-gl-geocoder. Reproduce by opening the Mapbox geocoder example at /examples/mapbox/geocoder and check whether the control renders without the reported TypeError. Done means the example loads with the geocoder control; pull request #2629 is already open against this issue.
Written by the indexing model from the issue text.
Description
Description
The Mapbox geocoder example on the website crashes on load with TypeError: i is not a function.
The error is thrown in generateSessionID() of @mapbox/[email protected], which calls require('nanoid')() and expects nanoid@2. The website's webpack config sets resolve.modules to absolute paths (from @vis.gl/docusaurus-website), so the nested nanoid@2 is skipped and the hoisted nanoid@3 is bundled. nanoid@3 has no default export.
Expected Behavior
The example renders a map with the geocoder control.
Steps to Reproduce
Open https://visgl.github.io/react-map-gl/examples/mapbox/geocoder
Environment
- Framework version: react-map-gl@8 (website, master)
- Map library: [email protected], @mapbox/[email protected]
- Browser: Chrome
- OS: macOS
Logs
TypeError: i is not a function
at generateSessionID
at onAdd
at addControl
- Dominant language
- TypeScript
- Stars
- 8.5k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from visgl/react-map-gl
-
DEFAULT_SETTINGS.maxBounds in @vis.gl/react-maplibre has 360° longitude span, triggers maplibre-gl-js#6148 crash via _updateSettings fallbackMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
visgl/react-map-gl#2591 · 2 comments ·
-
[Bug] Scroll zoom stops short of maxZoom in controlled mode with MapLibrePossibly taken @sviat-barbutsa claimed this 33 days ago. Openbug
Difficulty 3/5 Half a day Newbie friendliness 74/100
visgl/react-map-gl#2626 ·
-
[Bug] reuseMaps: Mapbox.reuse() infinite-loops (tab freeze) when the recycled map's container is the mount containerPossibly taken @mikeyfarina claimed this 82 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
visgl/react-map-gl#2613 ·
-
feature
Difficulty 5/5 Over a week Newbie friendliness 42/100
visgl/react-map-gl#2603 · 1 reaction ·
-
[Bug] Prop `style` does not unset properties that become `undefined`Possibly taken @MohammadYusif claimed this 140 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 66/100
visgl/react-map-gl#2595 · 3 comments ·
All issues in visgl/react-map-gl
Similar issues
-
accessibility area:ci ci-test level:low priority:high type:test
Difficulty 2/5 1-3 hours Newbie friendliness 71/100
skytuhua-org/Gen-V1#3132 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
drmrd/vernacular#1238 ·
Maintainers usually reply within 1 day
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
enhancement migration-prioritized
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Hudson-Pufferfish/local-party-console#136 ·
Maintainers usually reply within 1 day
-
priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day