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 out of order defines in a built file #1389

Closed
jrburke opened this Issue Jul 17, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@jrburke
Member

jrburke commented Jul 17, 2015

A secondary issue found with requirejs/r.js#833: when the loader processes define() calls, it enables them and its dependencies. This triggers check() which can then lead to a fetch of the dependencies. However, in a built file, if the dependency is defined, but below the current define()'d module being processed, it can lead to an incorrect fetch instead of just waiting for the deifne() calls to be fully processed.

Example:

// bar.js
define('bar', function(require) {
    var foo = require("./foo");
});
define('foo', function () {});

// app.js
define(['bar'], function () {});

Requiring 'app', which will then load 'bar', will lead to fetch for 'foo', when the define()'d 'foo' later in the bar.js file should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment