Skip to content
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

Is this library tree-shakable? #50

Closed
rmeshksar opened this issue Jan 16, 2022 · 1 comment
Closed

Is this library tree-shakable? #50

rmeshksar opened this issue Jan 16, 2022 · 1 comment
Milestone

Comments

@rmeshksar
Copy link

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.

@connor4312
Copy link
Owner

connor4312 commented Mar 12, 2022

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);

@connor4312 connor4312 added this to the 3.0 milestone Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants