Skip to content

Commit e6b2cf0

Browse files
MoOxfacebook-github-bot
authored andcommitted
Fix incorrect module.name_mapper in template .flowconfig (#26330)
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
1 parent 16d8802 commit e6b2cf0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

template/_flowconfig

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ module.file_ext=.ios.js
3636

3737
munge_underscores=true
3838

39-
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/Libraries/react-native/react-native-implementation'
40-
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/\1'
41-
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'
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
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>/node_modules/react-native/Libraries/Image/RelativeImageStub'
4242

4343
suppress_type=$FlowIssue
4444
suppress_type=$FlowFixMe

0 commit comments

Comments
 (0)