#14109 closed defect (fixed)
circular dependency graph with built legacy modules fails to load
Reported by: | Rawld Gill | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | Loader | Version: | 1.7.0b1 |
Keywords: | Cc: | Adam Peller | |
Blocked By: | Blocking: |
Description (last modified by )
When a set of legacy modules load in such a way as to define a cycle somewhere in their dependency graph, and further, such an application is built, then the loader backcompat dojo/require! and dojo/loadInit! plugins will fail to achieve a complete state (module x is perpetually waiting for y, and y is perpetually waiting for x).
The error does not show up in normal, synchronous, unbuilt loading.
The error does show up when loading normal, synchronous, unbuilt modules when the loader shifts to xdomain mode.
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Note: this bug originated while trying to build https://github.com/maqetta/maqetta
comment:4 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Summary: | circular dependency graph with build legacy modules fails to load → circular dependency graph with built legacy modules fails to load |
Note: See
TracTickets for help on using
tickets.
The problem is in the backcompat dojo/require and dojo/loadInit plugins in the loader. There is no builder error.
Given module A has the dependency
dojo.require!x
which insists that x and all of it's dependencies have arrived, then if module x has the dependency
dojo.require!A
, the dojo/require plugin will fail to properly resolve. This is owing to the current algorithm which tries to load legacy trees as soon as they can be resolved.
A simpler algorithm is to just hold all legacy loading until all legacy requires have been downloaded, and then proceed. This allows circular graphs to be resolved as if there was no build/xdomain loader.
There is no additional cost to this simpler algorithm in build code. It also is much shorter. Therefore, switching algorithms.