Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CJS-style AMD to execute in require-order. #1484

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthewp
Copy link
Member

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.

Closes #1483

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.

Closes #1483
@mjstahl
Copy link
Contributor

mjstahl commented Dec 12, 2018

I updated and the error below is what I got when using a dev-bundle:

screen shot 2018-12-12 at 9 57 45 am

I also tried a built version and got the following error:
screen shot 2018-12-12 at 10 00 31 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants