Skip to content

Commit 1cfd0b7

Browse files
committed
🐛 [Flow] Fix absolute imports
1 parent e7565b2 commit 1cfd0b7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.flowconfig

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[ignore]
2+
<PROJECT_ROOT>/build/.*
3+
<PROJECT_ROOT>/dist/.*
4+
<PROJECT_ROOT>/docs/.*
5+
<PROJECT_ROOT>/public/.*
26

37
[include]
48

@@ -8,9 +12,12 @@ flow-typed
812
[lints]
913

1014
[options]
11-
# NOTE: Following lines are needed for absolute path imports to work
12-
# https://itnext.io/configure-absolute-paths-with-create-react-app-and-flow-e4b8922676a2
13-
module.system.node.resolve_dirname=node_modules
14-
module.system.node.resolve_dirname=src
15+
; NOTE: This is needed for absolute imports to work
16+
module.name_mapper='^components/\(.*\)$' -> '<PROJECT_ROOT>/src/components/\1'
17+
module.name_mapper='^config/\(.*\)$' -> '<PROJECT_ROOT>/src/config/\1'
18+
module.name_mapper='^constants/\(.*\)$' -> '<PROJECT_ROOT>/src/constants/\1'
19+
module.name_mapper='^redux/\(.*\)$' -> '<PROJECT_ROOT>/src/redux/\1'
20+
module.name_mapper='^singletons/\(.*\)$' -> '<PROJECT_ROOT>/src/singletons/\1'
21+
module.name_mapper='^utils/\(.*\)$' -> '<PROJECT_ROOT>/src/utils/\1'
1522

1623
[strict]

0 commit comments

Comments
 (0)