I have a durandal (basically requirejs) module that starts like this:
define(['plugins/http', 'durandal/app', 'knockout', 'plugins/ajax', 'plugins/formatters', 'durandal/global'],
function (http, app, ko, ajax, formatters, global) {
//formatters is defined here
var ctor = function () {
//formatters is not defined here
I put a breakpoint in the debugger and found that formatters is defined outside the function but inside the function it isn't...
Is this unique to requirejs modules? Usually variables declared outside the function can still be accessed in inner functions unless overridden. This seems like some kind of scope problem, but I don't understand what am I missing here - the inner function in within the scope of the outer one, so what's the problem?
Thanks!