I am importing whatwg-fetch
(https://github.com/github/fetch) into my app
import fetch from 'whatwg-fetch';
For local development I use webpack-dev-server
. I got this error message:
test.js?ba55:67 Uncaught TypeError: (0 , _whatwgFetch.fetch) is not a function
It is fired from this line:
fetch('/api/mydata', opts)
Why the import failed?
whatwg-fetch
is actually a polyfill
I only need to import it this way:
import 'whatwg-fetch';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With