You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Making the url name on npm use the latest node style URL or whatwg-url would make it much easier to do polyfills, since you can always just write import { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current url package does not expose the URL constructor in accordance to whatwg url and the browser's window.URL.
@stevenvachon Thanks for pointing out universal-url project to me, it looks like I can make do with this for now.
thanks for your reply
On 09/13/2017 16:02, Roger Qiu wrote: Making the url name on npm use the latest node style URL or whatwg-url would make it much easier to do polyfills, since you can always just write import { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current url package does not expose the URL constructor in accordance to whatwg url and the browser's window.URL.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/defunctzombie/node-url","title":"defunctzombie/node-url","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/defunctzombie/node-url"}},"updates":{"snippets":[{"icon":"PERSON","message":"@CMCDragonkai in #33: Making the `url` name on npm use the latest node style URL or `whatwg-url` would make it much easier to do polyfills, since you can always just write `import { URL } from 'url';`, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current `url` package does not expose the `URL` constructor in accordance to whatwg url and the browser's window.URL."}],"action":{"name":"View Issue","url":"#33 (comment)"}}}
Does node's url module support this? If so, great! A PR would be appreciated. If not, we can't add this feature, and this should be closed, in favor of a feature request on node itself.
Looks like the URL property was added sometime in node 6 (between v6.6, where it's absent, and v6.17, where it's present) so we'll add it as we catch up to that featureset.
Activity
felixfbecker commentedon Apr 30, 2017
https://github.com/jsdom/whatwg-url seems to be the most active
stevenvachon commentedon Apr 30, 2017
That's what universal-url uses, and also provides universal-url-lite for file size control.
CMCDragonkai commentedon Sep 13, 2017
Making the
urlname on npm use the latest node style URL orwhatwg-urlwould make it much easier to do polyfills, since you can always just writeimport { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this currenturlpackage does not expose theURLconstructor in accordance to whatwg url and the browser's window.URL.@stevenvachon Thanks for pointing out universal-url project to me, it looks like I can make do with this for now.
gwiron commentedon Sep 14, 2017
sheepsteak commentedon Mar 3, 2018
Is it worth depending on url-polyfill and re-exporting
URLandURLSearchParams?It seems to be a small polyfill although it doesn't claim to have 100% support of the API.
stevenvachon commentedon Nov 28, 2018
httpin Node.js v11 usesURLunder the hood by default.ljharb commentedon Jan 27, 2021
Does node's
urlmodule support this? If so, great! A PR would be appreciated. If not, we can't add this feature, and this should be closed, in favor of a feature request on node itself.ljharb commentedon Jan 27, 2021
Looks like the
URLproperty was added sometime in node 6 (between v6.6, where it's absent, and v6.17, where it's present) so we'll add it as we catch up to that featureset.stevenvachon commentedon Jan 29, 2021
I remember it being added in v7, then back-ported to v6. I'm not sure if v6 has
globalThis.URLor only hasrequire('node').URL.url.URLis undefined #78 as a duplicate of this issue