javascript - dojo.require not loading in recursive order -
i'm trying move of dojo 1.7 codebase online. i've enabled cors on server, , local/online files loaded dojo.require
.
while worked fine local files, http files fail load in recursive order. example,
dojo.registermodulepath("my.path", "http://my.path"); dojo.require(my.path.module1); dojo.require(my.path.module2);
now, assuming module1
file loaded, , has own sub-dependencies, dojo.require
supposed load sub-dependencies first; observed online files, goes directly loading module2
, breaks order.
as result app won't function. how so?
generally speaking, dependencies @ same "level" (e.g. 2 dojo.require
calls in same module) aren't expected order-dependent. if module2
depends on module1
having been loaded, module2
should contain require
call module1
, accurately express recursive dependency.
i advise against assuming dojo.require
operates synchronously - operating under assumption break moment try cross-domain build, or update use loader in proper amd mode async: true
.
meanwhile, if "local" mean filesystem access, it's highly recommended use actual web server run web applications. browsers typically operate more restrictively file:// urls, example blocking xhr.
Comments
Post a Comment