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

fix(browser): avoid global-conflicting variable name fetch #199

Merged
merged 2 commits into from
May 14, 2021

Conversation

ItalyPaleAle
Copy link
Contributor

Here's a tiny fix that should hopefully save a lot of people a lot of headaches.

esbuild (and apparently other bundlers too) when outputting a single JS module (for esbuild, that's in --format=esm), everything is concatenated in a single file and de-scoped.

Because jose defines a variable called fetch, that overrode the window.fetch method, and it was causing all fetch requests in my app to fail.

Took a while to figure out. I was able to find a workaround by switching esbuild to --format=iife, which was fine for my app, but if someone needs an output as esm, they are stuck.

@panva panva changed the title Renamed fetch -> fetchJSON fix(browser): avoid global-conflicting variable name fetch May 14, 2021
@panva panva merged commit b2c6273 into panva:main May 14, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants