Skip to content

Commit 936668c

Browse files
authored
Add readme note about cyclical dependencies
Closes #30
1 parent 25539b2 commit 936668c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ Alternatively, if you want to use exactly the same transformation code for both
154154

155155
Note that there have been no reports of problems arising from differences between code compiled by the `ts-jest` transformer and code compiled by `react-native-typescript-transformer`. Additionally, `ts-jest` takes care of a lot of edge cases and is more configurable.
156156

157+
## Avoid cyclical dependencies
158+
159+
If you're transitioning an app from `tsc` to `react-native-typescript-transformer`, you might be seeing runtime errors that involve imported modules being `undefined`. You almost certainly have cyclical inter-module dependencies which manifest during your app's initialization. e.g. if ModuleA is `undefined` in ModuleB it means that ModolueA (in)directly imports ModuleB.
160+
161+
`tsc` seems to be able to mitigate some instances of these cyclical dependencies when used as a whole-app compiler. Unfortunately the module-at-a-time compilation approach that react-native's bundler supports does not permit the same optimizations.
162+
163+
Be especially careful of "umbrella export" files which can easily introduce these cycles.
164+
157165
## License
158166

159167
MIT

0 commit comments

Comments
 (0)