Skip to content

Commit 84a57c5

Browse files
authored
docs: document workaround for inlineRequires issues (#896)
1 parent cfa67c6 commit 84a57c5

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

website/docs/help/Troubleshooting.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,52 @@ title: Troubleshooting
44
sidebar_label: Troubleshooting
55
---
66

7+
## Async await doesn't resolve
8+
9+
If you're having issues with `getItem()` and friends not resolving, check if
10+
`inlineRequires` is enabled in `metro.config.js`:
11+
12+
```js
13+
module.exports = {
14+
transformer: {
15+
getTransformOptions: async () => ({
16+
transform: {
17+
experimentalImportSupport: false,
18+
inlineRequires: true,
19+
},
20+
}),
21+
},
22+
};
23+
```
24+
25+
If disabling it resolves the issue, it's likely that you hit a circular import
26+
chain. You can try excluding `@react-native-async-storage/async-storage` from
27+
being inlined:
28+
29+
```diff
30+
module.exports = {
31+
transformer: {
32+
getTransformOptions: async () => ({
33+
transform: {
34+
experimentalImportSupport: false,
35+
inlineRequires: true,
36+
+ nonInlinedRequires: [
37+
+ "@react-native-async-storage/async-storage",
38+
+ 'React',
39+
+ 'react',
40+
+ 'react-native',
41+
+ ],
42+
},
43+
}),
44+
},
45+
};
46+
```
47+
48+
If this doesn't resolve the issue, you need to figure out what is causing the
49+
cyclic chain. There are tools, such as
50+
[@rnx-kit/metro-plugin-cyclic-dependencies-detector](https://github.com/microsoft/rnx-kit/tree/main/packages/metro-plugin-cyclic-dependencies-detector#rnx-kitmetro-plugin-cyclic-dependencies-detector),
51+
that can help you debug this.
52+
753
## [iOS] CocoaPods issues
854

955
1. Delete the `node_modules` folder(s) from your project
@@ -54,7 +100,7 @@ info 1 error generated.
54100

55101
## [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null
56102

57-
#### iOS
103+
### iOS
58104

59105
This error means that AsyncStorage was unable to find its native module. This
60106
occurs because AsyncStorage was not linked into the final app bundle.

0 commit comments

Comments
 (0)