You mention
For use with webpack, add this package in the entry configuration option before your application entry point:
entry: ['whatwg-fetch', ...]
I don't understand if this is optional or complements the next part which is importing.
Also, why is it necessary to change the webpack configuration to load this specific module?
(Not a webpack user myself) If you use webpack for your application, then you have to somehow import the fetch polyfill, right? How do you otherwise do it for other polyfills?
I thought I just do npm install <packagename> and then (provided the package is CommonJS/Harmony compliant) I just do import packagename from 'packagename'. Then webpack would look it up into node_modules and that's all..
The package is not CommonJS/Harmony compliant. It's a polyfill, meaning that instead of exporting some functions, it writes to window.fetch only if window.fetch was missing.
Anyway, if you catch something wrong with our webpack instructions, and know some other instructions that work better than ones we've provided, please open a pull request with corrections. Otherwise, we're just speculating in this thread and not really going anywhere. Thank you!
Thanks, I ended up using Axios instead which didn't require changing
webpack configuration.
On 6 Jul 2017 18:27, "Mislav Marohnić" notifications@github.com wrote:
The package is not CommonJS/Harmony compliant. It's a polyfill, meaning
that instead of exporting some functions, it writes to window.fetch only
if window.fetch was missing.Anyway, if you catch something wrong with our webpack instructions, and
know some other instructions that work better than ones we've provided,
please open a pull request with corrections. Otherwise, we're just
speculating in this thread and not really going anywhere. Thank you!—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/github/fetch/issues/539#issuecomment-313430405, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABr9gmvGoYSuEB4Tac0doEuOd2AhAl_Nks5sLPzRgaJpZM4OOqwi
.
Most helpful comment
The package is not CommonJS/Harmony compliant. It's a polyfill, meaning that instead of exporting some functions, it writes to
window.fetchonly ifwindow.fetchwas missing.Anyway, if you catch something wrong with our webpack instructions, and know some other instructions that work better than ones we've provided, please open a pull request with corrections. Otherwise, we're just speculating in this thread and not really going anywhere. Thank you!