Closed fregante closed 1 year ago
Thank you, this makes for a great Epic for folks to work from.
If anyone can take a swing at knocking out a few of these that sounds be hugely helpful.
Maybe this will help: https://stackblitz.com/edit/webpack-webpack-js-org-vcdpkp?file=src/index.js
I've taken it, please wait for the PR when the Hacktoberfest starts :smile:
it seems node-fetch dependency recreate this issue. How to compile it now for browsers in webpack ?
node-fetch is importing node:http instead of http, node"fs instead of fs, .... So all webapck classiuc NodePolyfills are no more working
The browser compatibility claimed by this package is only due to bundlers’ polyfills, which are increasingly missing:
http
andhttps
can be replaced byfetch
, which is available in Node 18 and can already be used everywhere with https://github.com/matthew-andrews/isomorphic-fetch. I think this would also avoidBuffer
issuesURLs can be parsed with the
URL
constructor, available globally in Node 10.They can all be replaced by their modern and cross-platform equivalents or they can use something like
globalThis.process?.platform
to ensure that they don't immediately fail when missing.