-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Improve compatibility with browser by using better APIs #275
Comments
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 😄 |
it seems node-fetch dependency recreate this issue. node-fetch is importing node:http instead of http, node"fs instead of fs, .... |
The browser compatibility claimed by this package is only due to bundlers’ polyfills, which are increasingly missing:
json-schema-ref-parser/lib/util/url.js
Lines 25 to 26 in 5d7f895
json-schema-ref-parser/lib/util/url.js
Line 3 in ce23669
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.The text was updated successfully, but these errors were encountered: