Nick Allen Nick Allen - 6 months ago 25
Node.js Question

How does React Native require(moduleName) work?

I saw code like

var Animated = require('Animated')
in react-native source code. But how can this be resolved without a path ?

My guess is that will be preprocessed by the packager by something like registering and I would like to do this in my own project. But there seems to be no document for react-native's packager , and I can't find the source code where this "registering" happen.

Answer

I think I find it ! issue 896 , just add @providesModule moduleName in the file's comment in the header.

Comments