Skip to content

[build-optimizer] Ivy code is not full tree shaken / marked @PURE #11796

Closed
@hansl

Description

@hansl

Building an app with Ivy and optimizations on, I see the following code still there:

Before Uglify:

var NgModuleFactory$1 = /** @class */ (function (_super) {
    __extends(NgModuleFactory$$1, _super);
    function NgModuleFactory$$1(moduleType) {
        var _this = _super.call(this) || this;
        _this.moduleType = moduleType;
        return _this;
    }
    NgModuleFactory$$1.prototype.create = function (parentInjector) {
        return new NgModuleRef$1(this.moduleType, parentInjector);
    };
    return NgModuleFactory$$1;
}(NgModuleFactory));

After Uglify (with mangle off):

        !function(_super) {
            function NgModuleFactory$$1(moduleType) {
                var _this = _super.call(this) || this;
                return _this.moduleType = moduleType,
                _this
            }
            __extends(NgModuleFactory$$1, _super),
            NgModuleFactory$$1.prototype.create = function(parentInjector) {
                return new NgModuleRef$1(this.moduleType,parentInjector)
            }
        }(function() {}),

We would expect the first snippet to have a @PURE annotation on it following the @class, and the function not to be there at all after uglify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions