Is this library tree-shakable?
rmeshksar opened this issue · comments
Hi,
Thanks for the great library.
I used this library for the first time in my Angular application and it works great.
In my example, I only import Policy and retry but noticed even in production build the whole library is in the generated code.
My question is that if this library is tree-shakable and if there is anything I need to do.
Thanks.
It's tree shakable, but due to the structure (which mirrors .NET Polly) policies don't get shaken out -- your code references Policy, which in turn is a factory for basically everything else. I want to tackle this for the 3.0 release. This might involve an API that looks something more like...
import { retry, handleType } from 'cockatiel';
const policy = retry(handleType(NetworkError)).attempts(3);