reactjs - How do the `require`s in React's repo work? -
i'm looking extending react addon , looking through require statements looks lot of them requiring modules don't exist. how work?
if i'm looking make extend reacttransitiongroup, has require('reacttransitionchildmapping');, reacttransitionchildmapping
isn't module, should do?
https://github.com/facebook/react/blob/master/src/addons/transitions/reacttransitiongroup.js
you can see requiring bunch of things aren't npm modules.
the react repo (and presumably other systems @ facebook) use custom require
resolution solution based around @providesmodule
annotation in various files. these compiled down standard commonjs modules via build step. check out reacttransitionchildmapping.js
, you'll see following comment, part of block comment:
@providesmodule reacttransitionchildmapping
Comments
Post a Comment