Skip to content

Modularize polyfills  #8854

@nippur72

Description

@nippur72

As far as I know, polyfill functions are repeated in each file they are needed, resulting in lot of duplicate code.

I suggest to optionally emit them as a module, so that they appear once in a bundled project.

E.g. instead of:

var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};

var myclass= (function (_super) {
    __extends(myclass, _super);
    // ...

emit this:

var __extends = require("typescript-polyfills").extends;

var myclass= (function (_super) {
    __extends(myclass, _super);
    // ...

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions