-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @ngtools/webpackfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity4: memory/performancetype: bug/fix
Milestone
Description
For a given service, Ivy outputs this:
import { Injectable } from '@angular/core';
import * as i0 from "@angular/core";
var bigDependencyLoader = function () { return import(/* webpackChunkName: "big-dependency" */ '../lorem/big-dependency'); };
var LoremService = /** @class */ (function () {
function LoremService() {
}
LoremService.prototype.load = function (options) {
return bigDependencyLoader().then(function (m) { return new m.BigDependency().setOptions(options); });
};
LoremService.ɵfac = function LoremService_Factory(t) { return new (t || LoremService)(); };
LoremService.ɵprov = i0.ɵɵdefineInjectable({ token: LoremService, factory: function (t) { return LoremService.ɵfac(t); }, providedIn: 'root'
});
return LoremService;
}());
export { LoremService };
/*@__PURE__*/ i0.ɵsetClassMetadata(LoremService, [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], null, null);
and VE outputs this:
import { __decorate } from "tslib";
import { Injectable } from '@angular/core';
import * as i0 from "@angular/core";
var bigDependencyLoader = function () { return import(/* webpackChunkName: "big-dependency" */ '../lorem/big-dependency'); };
var ɵ0 = bigDependencyLoader;
var LoremService = /** @class */ (function () {
function LoremService() {
}
LoremService.prototype.load = function (options) {
return bigDependencyLoader().then(function (m) { return new m.BigDependency().setOptions(options); });
};
LoremService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoremService_Factory() { return new LoremService(); }, token: LoremService, providedIn: "root" });
LoremService = __decorate([
Injectable({ providedIn: 'root' })
], LoremService);
return LoremService;
}());
export { LoremService };
export { ɵ0 };
The CLI actually has a dedicated pass to remove the __decorate
call in https://github.com/angular/angular-cli/blob/master/packages/ngtools/webpack/src/transformers/remove_decorators.ts.
If it's not needed in Ivy, we could disable that pass for faster builds and rebuilds.
Metadata
Metadata
Assignees
Labels
area: @ngtools/webpackfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity4: memory/performancetype: bug/fix