Closed jacobrask closed 5 years ago
You're right! the issue with importing/requiring whatwg-fetch
is that it's going to polyfill your environment. It's not going to be an option anymore, it will be mandatory. Although there will be duplicate code in node_modules, it's going to be a very small one. So it's a cheap price to pay to have a clean ponyfill.
Ok, I see the reason then, but whatwg-fetch is almost 8kB, I wouldn't consider that negligible, it all adds up in a large project.
Unfortunately I don't see any alternative to that. Closing the issue.
Instead of bundling the entire whatwg-fetch, could it be a
require()
call, like inisomorphic-fetch
andisomorphic-unfetch
?The
browser
field is the default entry point for all Webpack builds, which means that anyone using Webpack and accidentally including some other package that also pulls inwhatwg-fetch
will get duplicate copies.