Traditionally AMD executes all dependencies before executing a module.
CommonJS, on the other hand, executes in require-order. That is, require
determines the execution order.
When transpiling CJS to AMD this can cause a problem where a module
written for CJS that contains a circular dependency where it depends on
require execution order can break.
This change allows for CJS-style AMD modules to execute in
require-order. There is a flag in Steal, executingRequire that
triggers this. We turn this flag on in a CJS-style AMD module, and only
execute dependencies up front, if those dependencies are listed before
the first exports, module, or require dependency.
Traditionally AMD executes all dependencies before executing a module. CommonJS, on the other hand, executes in require-order. That is, require determines the execution order.
When transpiling CJS to AMD this can cause a problem where a module written for CJS that contains a circular dependency where it depends on require execution order can break.
This change allows for CJS-style AMD modules to execute in require-order. There is a flag in Steal,
executingRequire
that triggers this. We turn this flag on in a CJS-style AMD module, and only execute dependencies up front, if those dependencies are listed before the firstexports
,module
, orrequire
dependency.Closes #1483