Opened 9 years ago
Closed 9 years ago
#16905 closed defect (invalid)
Cached modules are not loaded on require
Reported by: | Marten Lienen | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Loader | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Hi, I have a custom build with 2 files:
- dojo.js: Only the AMD loader
- app.js: Entrypoint of my app with all dependencies cached after building
Since my entrypoint is no module but more like a startup script, I used require instead of define. To make it work I had to replace require with define, but I think the cache should also be loaded on require.
Here is the comment from dojo.js where this is documented:
pendingCacheInsert // hash:(mid)-->(function) // // Gives a set of cache modules pending entry into cache. When cached modules are published to the loader, they are // entered into pendingCacheInsert; modules are then pressed into cache upon (1) AMD define or (2) upon receiving another // independent set of cached modules. (1) is the usual case, and this case allows normalizing mids given in the pending // cache for the local configuration, possibly relocating modules. = {},
Note: See
TracTickets for help on using
tickets.
Hi CQQL,
There is more to it. Cached modules may be mapped, and mapping cannot occur without a reference module. Therefore, the cached modules are not automatically consumed without a subsequent require.
Your can get the effect you want by setting the switch "noref" to truthy in your layer. See http://dojotoolkit.org/reference-guide/1.8/build/transforms/writeAmd.html#build-transforms-writeamd.