You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unused classes got added in build, tree-shaking not working propely聽#15396
check build source-
In that, "main-es5.js" and "main-es2015.js" has all modules, no tree shaking.
check string [getModuleName=function()] in bundle file , you can find it 61 times which means all other modules are imported even if they are not used. This shows unused classes are not getting tree-shaken.
馃敟 Exception or Error
While using GridAllModule , build size is 1.8mb
While using GridModule which has less no of imported class, build size is same.
Following this PR #14998 that landed in 8.2, we are using this field to determine whether build-optimizer should try to optimize a library, if no such field is found in the package.json, build-optimizer will not perform any optimizations on that library.
It is also paramount to mention that the @syncfusion libraries are not using TypeScript helpers such as __decorate, __extends etc... via tslib but rather these are being inlined in the bundle. The library author should enable importHelpers option found in the compilerOptions of their tsconfig.json.
NB: In future optimizations related to TypeScript helpers replacements will be removed from build optimizer.
Following this PR #14998 that landed in 8.2, we are using this field to determine whether build-optimizer should try to optimize a library, if no such field is found in the package.json, build-optimizer will not perform any optimizations on that library.
It is also paramount to mention that the @syncfusion libraries are not using TypeScript helpers such as __decorate, __extends etc... via tslib but rather these are being inlined in the bundle. The library author should enable importHelpers option found in the compilerOptions of their tsconfig.json.
NB: In future optimizations related to TypeScript helpers replacements will be removed from build optimizer.
Activity
Saranya13 commentedon Aug 21, 2019
@alan-agius4 ,
For your reference.
Issue occurs in latest angular-cli version 8.2.2 also
kumaresan-subramani commentedon Aug 21, 2019
Hi,
It is working fine in below environmen:
Please find working sample here-
treeshake-issue.zip
alan-agius4 commentedon Aug 21, 2019
Hi all,
I had a look at this issue and the reason why tree-shaking is not working is that
@syncfusionpackages do not specify atypingsfield in theirpackage.json. This field is typically added to TypeScript generated libraries and is also part of the APF specs (https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview).Following this PR #14998 that landed in 8.2, we are using this field to determine whether build-optimizer should try to optimize a library, if no such field is found in the package.json, build-optimizer will not perform any optimizations on that library.
It is also paramount to mention that the
@syncfusionlibraries are not using TypeScript helpers such as__decorate,__extendsetc... via tslib but rather these are being inlined in the bundle. The library author should enableimportHelpersoption found in thecompilerOptionsof theirtsconfig.json.NB: In future optimizations related to TypeScript helpers replacements will be removed from build optimizer.
kumaresan-subramani commentedon Aug 22, 2019
HI @alan-agius4 ,
Thanks for your response. While adding
typingsfield in our packages, tree-shaking works fine as expected.clydin commentedon Sep 25, 2019
This issue appears to have been resolved. If this has been closed in error, please let us know.
angular-automatic-lock-bot commentedon Oct 26, 2019
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.