Search code examples
node.jsreact-nativecommonjs

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.


Solution

  • I think I find it! Just add @providesModule moduleName in the file's comment in the header , look into issue 896 for detail.