Opened 11 years ago

Closed 11 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:


Prior to 1.7, built code contained a lot of statements like:


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 11 years ago by Douglas Hays

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.

comment:2 Changed 11 years ago by Douglas Hays

Cc: [email protected] added
Priority: normalhigh

comment:3 Changed 11 years ago by Douglas Hays

Joel confirmed that adding
dojo._hasResource = {};
to kernel.js prevented the exception.

comment:4 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

In [26592]:

Fixes #13845. Define an empty object dojo._hasResource for backward compatibility with layers built with 1.6 tooling. Reviewed by Rawld. !strict

Note: See TracTickets for help on using tickets.