Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify if removeDecorators transform is needed with Ivy #16070

Closed
filipesilva opened this issue Nov 5, 2019 · 3 comments · Fixed by #16086
Closed

Verify if removeDecorators transform is needed with Ivy #16070

filipesilva opened this issue Nov 5, 2019 · 3 comments · Fixed by #16086
Assignees
Labels
area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity4: memory/performance type: bug/fix
Milestone

Comments

@filipesilva
Copy link
Contributor

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.

@filipesilva filipesilva added feature Issue that requests a new feature area: @ngtools/webpack labels Nov 5, 2019
@filipesilva filipesilva added this to the v9-candidates milestone Nov 5, 2019
@filipesilva filipesilva changed the title Verify if removeDecorators transfom is needed with Ivy Verify if removeDecorators transform is needed with Ivy Nov 5, 2019
@filipesilva
Copy link
Contributor Author

filipesilva commented Nov 5, 2019

@alxhub confirmed that this is still needed, ngcc removes the top-level decorators, but not the rest of the metadata (inputs, ctor parameters, etc).

@filipesilva
Copy link
Contributor Author

I misunderstood actually, I thought that comment was about the app compile but it was ngcc.

@alxhub says:

In the app compile, Ivy completely removes the decorators afaik.

So we should be ok to not run this transform on Ivy apps.

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Nov 6, 2019
@filipesilva filipesilva added freq1: low Only reported by a handful of users who observe it rarely severity4: memory/performance type: bug/fix and removed feature Issue that requests a new feature labels Nov 6, 2019
@filipesilva filipesilva self-assigned this Nov 7, 2019
@vikerman vikerman modified the milestones: v9-candidates, v9-blockers Nov 7, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 9, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity4: memory/performance type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants