Flow reports errors about missing modules
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 0.48
### Steps to Trigger Behavior
1. Update mapbox-gl and Flow to latest versions
2. Add `node_modules/mapbox-gl/flow-typed` to [libs] section in .flowconfig
3. Run Flow analysis
### Link to Demonstration
The problem can be seen in repo https://github.com/mikkom/onnikka by running `yarn && yarn flow`.
### Expected Behavior
No Flow errors (at least from within mapbox-gl).
### Actual Behavior
Flow reports two errors where it cannot resolve a module.
```
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/mapbox-gl/src/util/window.js:5:16
Cannot resolve module gl.
2│
3│ import jsdom from 'jsdom';
4│
5│ import gl from 'gl';
6│ import sinon from 'sinon';
7│ import { extend } from './util';
8│
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/mapbox-gl/src/util/window.js:6:19
Cannot resolve module sinon.
3│ import jsdom from 'jsdom';
4│
5│ import gl from 'gl';
6│ import sinon from 'sinon';
7│ import { extend } from './util';
8│
9│ import type {Window} from '../types/window';
```
Manually adding gl and sinon as dependencies in the project removes both errors but I think that should not be necessary?
Contributor 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.
Research direction
Reproduce the report with `yarn && yarn flow` in the linked onnikka repository, then inspect `src/util/window.js`, especially its `gl` and `sinon` imports, together with the `flow-typed` setup. Done means Flow no longer reports module-resolution errors from mapbox-gl without manually adding those dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100