-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Unused down-levelled ES2015 classes are not tree shaken away #14997
Comments
I have tried this mishoo/UglifyJS#2279 (comment) But no solution |
Someone can correct me if I am wrong, but I am fairly sure that you need to set module type to esnext/es2015 in ts config. In the zip you've linked, module is set to es5. |
I thought this should be root cause - microsoft/TypeScript#13721 |
@alan-agius4 , Can you please see this? |
Hi I had a look at this is being retained because of ES5 classes are not being wrapped in an IIFE which is making code non tree-shakable. The issue seems to happen when downlevelling from ES2015 to ES5 which was being done in ng-packagr version 1.5 which you are using to build your libraries. Downlevelling was removed in version 4. This most likely is also caused by the removal of the |
HI @alan-agius4 , Can you please let me know tentative timeline for this to proceed further since tree shaking is considered as major break by most of the application developers. |
At the moment, there is no ETA yet, though if someone want to land a PR they are more than welcome. We work on issues based on how their categorised, and this one is classified as The main reason for this classification is;
Thanks for your understanding. |
I am going to close this, since this issue is caused when using an old version of ng-packagr which relied on TSC downlevelling, this version supported Angular 4 which is no longer supported. Kindly be aware that Angular 8 is in LTS and it's support will end on the Nov 28, 2020. Please update to the most recent Angular CLI and ng-packagr version. If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)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
Download sample form below link - click here
Run below commands :
🔥 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
🌍 Your Environment
Anything else relevant?
I thought, while tree-shaking it includes all imported files.
The text was updated successfully, but these errors were encountered: