Skip to content

UMD output does not work with require.js optimizer #4952

@xi

Description

@xi

When using the UMD module output, the require.js optimizer is not able to trace dependencies. My first impulse was to fix it there (see requirejs/r.js#857), but their feedback was that it would probably be easier to change the output to something like this:

(function (factory) {
    if (typeof module === 'object' && typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' && define.amd) {
        define(['require', 'exports', 'lib'], factory);
    }
})(function (require, exports) {
    var lib = require('lib');
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions