Nick Allen Nick Allen - 2 years ago 127
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download