Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.61.0-rc.0] wrong Flow module name mappers #26233

Closed
thymikee opened this issue Aug 28, 2019 · 0 comments
Closed

[0.61.0-rc.0] wrong Flow module name mappers #26233

thymikee opened this issue Aug 28, 2019 · 0 comments
Labels
Bug Flow p: Callstack Partner: Callstack Partner Resolution: Locked This issue was locked by the bot.

Comments

@thymikee
Copy link
Contributor

thymikee commented Aug 28, 2019

React Native version:

v0.61.0-rc.0

Steps To Reproduce

  1. npx react-native init --version 0.61.0-rc.0
  2. or react-native upgrade

Describe what you expected to happen:

Flow should see assets as images, but see strings. This is caused by wrong module name mapper config.

Snack, code example, screenshot, or link to a repository:

Code in template/_flowconfig:

module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/\1'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'

The fix is: <PROJECT_ROOT> -> <PROJECT_ROOT>/node_modules/react-native.

I'd send the fix myself, but I'm short on time now, just wanted to make sure it's noticed.

@thymikee thymikee added the Bug label Aug 28, 2019
grabbou pushed a commit that referenced this issue Sep 10, 2019
Summary:
Has explained in #26233, current template is incorrect & can create error, like having require() of png that are considered as `string` instead of `number. This can probably hide tons of similar mistakes.

The change in this PR should resolve the previous behavior (& for example, some places in previous version of the flowconfig have the full path like here https://github.com/facebook/react-native/blob/35300147ca66677f42e8544264be72ac0e9d1b45/template/_flowconfig#L61)

Closes #26233

## Changelog

```
[General] [Fixed] Fix incorrect `module.name_mapper` in template .flowconfig
```

Alternatively, message could be

```
[General] [Internal] Fix incorrect `module.name_mapper` in template .flowconfig
```

As it hasn't this "bug" hasn't been released in a public stable release. You decide
Pull Request resolved: #26330

Test Plan: I just tested this in my project, thymikee might be able to confirm & approve this PR.

Differential Revision: D17258891

Pulled By: cpojer

fbshipit-source-id: 3904ffbc6f076ee0e435311249d694b8604fc7b8
@facebook facebook locked as resolved and limited conversation to collaborators Oct 4, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Flow p: Callstack Partner: Callstack Partner Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants