I'm searching through react-0.13.3.js
and one thing I can't work out. At the very start of the source there's a bunch of dereq()
calls.
'use strict';
var EventPluginUtils = _dereq_(19);
var ReactChildren = _dereq_(32);
var ReactComponent = _dereq_(34);
var ReactClass = _dereq_(33);
But nowhere do I see an implementation for that function. What does it do and how does it work? And most importantly, where is it declared?
I'm still waiting for a more comprehensive answer to accept. My main question is what does the _dereq_
function do and how does it work.
This is likely derequire combined with browserify (or other bundler?) module ids. It's a way to rename require
in your output bundle so as to avoid collisions.
Read here for more information: https://github.com/calvinmetcalf/derequire/issues/25
The basic idea is that different module loaders handle require
differently. "Derequire" is a strategy for binding your requires to your context via a different keyword.
It has to do with amd module loader. _dereq_
is the first argument so it's the require
function.
You need to expand line 4
in the source; it's require
.
1: [function(_dereq_, module, exports) {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With