Skip to content

ES2015 Class with decorators are not being treeshaken away #14610

Closed

Description

@alan-agius4

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

When not using tsickle, TypeScript emits the following code for classes which have property or method decorators

export class foo {
    bar() {
    }
}
__decorate([
    decorator()
], foo.prototype, "bar", null);

The problematic as terser is unable to drop the above code if the Class is unused.

🌍 Your Environment


Angular CLI: 8.0.0
Node: 11.0.0
OS: win32 x64
Angular: 8.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0
@angular-devkit/build-angular     0.800.0
@angular-devkit/build-optimizer   0.800.0
@angular-devkit/build-webpack     0.800.0
@angular-devkit/core              8.0.0
@angular-devkit/schematics        8.0.0
@ngtools/webpack                  8.0.0
@schematics/angular               8.0.0
@schematics/update                0.800.0
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

Related to #14577

Activity

  1. added this to the Backlog milestone on May 31, 2019
  2. changed the title [-]ES2015 class with decorators are not being treeshaken away[/-] [+]ES2015 Class with decorators are not being treeshaken away[/+] on May 31, 2019
  3. modified the milestones: Backlog, 8.1.0, 8.0.x on Jun 3, 2019
  4. kumaresan-subramani commented on Aug 21, 2019

    @kumaresan-subramani

    Hi @alan-agius4 ,

    still facing same issue, tree-shaking not working properly

    #15396

  5. angular-automatic-lock-bot commented on Sep 21, 2019

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Sep 21, 2019
  7. added a commit that references this issue on May 29, 2026
    28a92cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions