Allow out of order defines in a built file #1389

jrburke opened this Issue Jul 17, 2015 · 0 comments


None yet

1 participant

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.


// 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.

@jrburke jrburke added this to the 2.1.20 milestone Jul 17, 2015
@jrburke jrburke closed this in e6bc5e2 Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment