Skip to content
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

Remove dependency on url module in browser environments #326

Closed
mrlika opened this issue Aug 1, 2019 · 3 comments
Closed

Remove dependency on url module in browser environments #326

mrlika opened this issue Aug 1, 2019 · 3 comments

Comments

@mrlika
Copy link

mrlika commented Aug 1, 2019

const URL = require('url').URL

require('url') is a big module that also depneds on another not small module punnycode.

url module is redundant in browser environments. Compatible URL object already exists in the global scope there. Removing it significantly reduces output size of web bundles.

Can this require somehow be removed in browser environments?

@feross
Copy link
Member

feross commented Aug 3, 2019

Yes, I plan to do this. See this issue to track the progress: webtorrent/webtorrent#1681

@feross feross closed this as completed Aug 3, 2019
@guanzo
Copy link
Contributor

guanzo commented Aug 5, 2019

const URL = require('url').URL is not a valid export when this package is built with webpack (and browserify too I think). The shim package exports Url instead of URL.

defunctzombie/node-url#37

This error should go away when you drop the require, but wanted to let you know the current build will break when built by bundlers.

@feross
Copy link
Member

feross commented Aug 5, 2019

Fixed in 93b4139 and will go out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants