Closed unsafecode closed 4 years ago
Hi @unsafecode , thanks for reporting. I'll take a look ASAP.
Cheers!
Hi @unsafecode I upgraded to Angular 7 hoping that tree shaking would have been improved somehow but I'm having the same issues.
Not sure if there's something I can do until date-fns
v2 is released.
Take a look at this: https://github.com/date-fns/date-fns/blob/master/docs/esm.md
Suggestions / PRs are welcomed!
@joanllenas : As date-fns v2 is released. do we have any update on this open issue.
Hi @gmanoj26 , I took a look a while ago and didn't find a solution to the problem. V2 by itself didn't solve the issue. Maybe, for this to work we need something like what this article suggests; one pipe per module; but I think it's not a good idea given the number of pipes this library contains.
I'm open to discussing possible solutions if someone has the time to investigate.
I added a section about tree shaking in the docs. I hope this helps: https://github.com/joanllenas/ngx-date-fns#tree-shaking-date-fns
In order to make each pipe tree-shakable, those must be provided as secondary entry points (as stated by the article, 1 pipe per entry point / module). It can be easily done using ng-samurai schematics.
Willing to look into this as I am using this library but not being tree-shakable atm.
Description of the Issue and Steps to Reproduce:
Looks like the current implementation always imports all the pipe, making the final bundle excessively large:
It would be better to be able to import pipes in a more selective way, in order not to increase the final app size including unused code.
Environment:
Please answer the following questions:
ng-xdate-fns
version? 2.0.3