Skip to content

Allow out of order defines in a built file #1389

@jrburke

Description

@jrburke

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions