Opened 10 years ago
Closed 10 years ago
#13845 closed defect (fixed)
1.6 built layers need dojo._hasResource
Reported by: | Douglas Hays | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Core | Version: | 1.7.0b1 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
Prior to 1.7, built code contained a lot of statements like:
if(!dojo._hasResource["dijit.layout.TabContainer"]){dojo._hasResource["dijit.layout.TabContainer"]=true;dojo.provide("dijit.layout.TabContainer");
But now, _hasResource is undefined and thus custom user code that does not use Dojo but built using the build tools doesn't work anymore and has to be rebuilt, even though it doesn't even use Dojo APIs. For backward compatibility, we should add back the dojo._hasResource empty object.
Change History (4)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Cc: | [email protected]… added |
---|---|
Priority: | normal → high |
comment:3 Changed 10 years ago by
Joel confirmed that adding
dojo._hasResource = {};
to kernel.js prevented the exception.
Note: See
TracTickets for help on using
tickets.
From Joel Allen,
One of the complications here is that the AMD-oriented build tools change this mechanism by actually calling the require API in order to inject the module along with its moduleID into the internal Dojo AMD loader cache. this allows subsequent require(...) statements or define() statements with prereqs on that module to resolve it from the internal loader cache. a mere replacement of the dojo._hasResource object may be insufficient unless Dojo's AMD loader supports that as well. even then, the dojo._hasResource object is merely a map of key-value pairs whose values are actually boolean variables and aren't the AMD modules themselves.
One possible solution to this would be for Dojo to add a public API mechanism for which layer files built from older Dojo build tools can be augmented very simply to fix this and inject their own modules into the AMD loader. this mechanism would have to continue to support 1.6 and prior as well as 1.7+ probably by feature checking.