tim-kos / node-retry

Abstraction for exponential and custom retry strategies for failed operations.
Other
1.22k stars 80 forks source link

using proper scope for createTimeout #85

Open gautamkrishnar opened 2 years ago

gautamkrishnar commented 2 years ago

Using a proper scope to prevent errors with external bundlers

Why

I tried using node-retry with Parcel v2 it had a hard time finding the right module to map. Now when I ran the built code I got the following error:

TypeError: this.createTimeout is not a function

Using exports.* scope instead of this.* will prevent this error.

tyler-ham commented 2 years ago

I ran into the same problem. This fix worked for me.

gautamkrishnar commented 2 years ago

@tim-kos can you please take a look at this. Hope this can be merged into the repository.

LeoniePhiline commented 2 years ago

@tim-kos Maybe, if you see this, could you please merge? Thank you!

fregante commented 2 years ago

Same exact issue here.

The code isn't technically wrong, but it's a rare pattern that some bundlers don't account for when trying to optimize modules. Please merge this soon because it's equivalent but more compatible.

For anyone looking for an immediate, albeit non-optimal solution:

parcel build --no-scope-hoist