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

Check if using a method from a polyfill is the right approach #3311

Open
cmahnke opened this issue Oct 28, 2020 · 0 comments
Open

Check if using a method from a polyfill is the right approach #3311

cmahnke opened this issue Oct 28, 2020 · 0 comments

Comments

@cmahnke
Copy link

cmahnke commented Oct 28, 2020

See:

import fetch from 'isomorphic-unfetch';

I'm not a JS programmer and don't really know about the implications, but this line (importing the fetch method from the package isomorphic-unfetch) seems quite strange:

  • fetch is a method provided by modern browsers, and the package seems to be a workaround (aka polyfill), so there should be no need to use it directly
  • In src/polyfills.js the package unfetch is used, it's a gut feeling and certainly true with other languages, but using two packages providing one functionality is never a good idea, it creates confusion and weird problems.
  • The later is the reason why I found it: I Chrome I got the following error message TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation an Firefox also displayed an error regarding problems the Window interface. there are several reports over the net from different packages. Some are related to Webpack, but since i'm using ESBuild, these don't apply to my situation.

Anyways, it works if I just comment the line out, I haven't tested on older browsers yet, but my assumption is, that the polyfill covers this situation...

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

1 participant