Does passing [] (empty array) as dependencies an optimization to bypass require, exports, module?

33 views
Skip to first unread message

Brian Cray

unread,
Mar 19, 2013, 9:53:26 AM3/19/13
to amd-im...@googlegroups.com
Right now in my loader if dependencies.length === 0 then I replace it with [require, exports, module]. Is that required? If not it seems like a good optimization to bypass passing require, exports and module into the constructor.

John Hann

unread,
Mar 19, 2013, 11:26:40 AM3/19/13
to amd-im...@googlegroups.com
Hey Brian, see this issue: https://github.com/jrburke/requirejs/issues/669

 [require, exports, module] should only be injected if no dependency array was specified at all. :)

-- John


On Tue, Mar 19, 2013 at 9:53 AM, Brian Cray <bcra...@gmail.com> wrote:
Right now in my loader if dependencies.length === 0 then I replace it with [require, exports, module]. Is that required? If not it seems like a good optimization to bypass passing require, exports and module into the constructor.

--
You received this message because you are subscribed to the Google Groups "amd-implement" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amd-implemen...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brian Cray

unread,
Mar 19, 2013, 5:43:24 PM3/19/13
to amd-im...@googlegroups.com
thanks :)

Jakob Heuser

unread,
Mar 20, 2013, 1:13:44 PM3/20/13
to amd-im...@googlegroups.com
Just a note, Inject has this bug too, we've got an open issue on it as well.

I've also earmarked adding a test to the AMD suite to cover this use case. Will let people know when the pull request is up.
Reply all
Reply to author
Forward
0 new messages