Skip to content

Unused down-levelled ES2015 classes are not tree shaken away #14997

Closed
@kumaresan-subramani

Description

@kumaresan-subramani

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve

Description

I have created an angular application and checked main bundle whether tree-shaking is working or not using bundle-analyzer.

But i found all .js extension files are included.

🔬 Minimal Reproduction

  1. Download sample form below link - click here

  2. Run below commands :

npm i

npm run start - To generate build

npm run bundle-report - To check bundle files in online

🔥 Exception or Error

In below, i have not enabled pdf-export functionality in my application. In source level,i have done proper work for module injection but in below you can see pdfexport related js files are added.

Note: But pdf-export module not get added in main.bunlde.js file

marked files are not used but still getting added

sdf

🌍 Your Environment




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

 


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

 

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.6
@angular-devkit/build-angular     0.800.6
@angular-devkit/build-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.0.6
@angular-devkit/schematics        8.0.1 (cli-only)
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.6
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

I thought, while tree-shaking it includes all imported files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions