facebook / facebook/flow

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

Offen
#4,481 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
declarations module resolution
Vorherrschende Sprache
Rust
Sterne
22.3k
Forks
1.9k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.