Skip to content

using proper scope for createTimeout #85

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gautamkrishnar
Copy link

@gautamkrishnar gautamkrishnar commented Mar 6, 2022

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.

using proper scope to prevent errors with external bundlers
@tyler-ham
Copy link

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

@gautamkrishnar
Copy link
Author

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

moshthepitt added a commit to nova-launch/withdraw-royalties that referenced this pull request Apr 28, 2022
This commit simply ensures that "this.createTimeout" is replaced by "exports.createTimeout" in the
node-retry package.

This is so that we implement this PR: tim-kos/node-retry#85 before node-retry is
officially updated.
@LeoniePhiline
Copy link

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

@fregante
Copy link

fregante commented Jul 18, 2022

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

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

Successfully merging this pull request may close these issues.

4 participants