facebook / facebook/flow

module.name_mapper doesn't work when pointing to a file within flow-typed

Aperta
#4,481 3 commenti 1 reazione 0 assegnatari Vedi su GitHub
declarations module resolution
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

In my case, I was using `module.name_mapper.extension`, but `module.name_mapper` seemed to work the same.

If I have a `.flowconfig` like this:

```
[options]
module.name_mapper.extension='mp3' -> '/flow-typed/mp3-stub.js'
```

Flow will still error with "Required module not found" when importing an MP3 file. I have [a reduced case of this](https://github.com/bjohn465/flow-name_mapper-test/tree/3c17d1a4b9963412787b0c9e3a0ffaf51e471fb4).

When I move `mp3-stub.js` to a different directory, such as `flow-stubs`, the "Required module not found" error goes away, as seen [in this commit of the reduced case](https://github.com/bjohn465/flow-name_mapper-test/tree/335456fac80dd452469645930535861a91c3c4c7).

If this is intended behavior, it may be worth updating the [documentation](https://flow.org/en/docs/config/options/#toc-module-name-mapper-regex-string) to mention this restriction. I'd be willing to help with updating the documentation, if needed.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.