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

[3.0.0] URL is not a constructor #60

Closed
joncursi opened this issue May 29, 2018 · 5 comments · Fixed by #61
Closed

[3.0.0] URL is not a constructor #60

joncursi opened this issue May 29, 2018 · 5 comments · Fixed by #61

Comments

@joncursi
Copy link

I upgraded from the previous 2.x to 3.0.0 and started getting errors in my app:

import normalizeUrl from 'normalize-url';
normalizeUrl(...);

Error:

URL is not a constructor
@SamVerschueren
Copy link

What node version are you using?

@joncursi
Copy link
Author

v10.2.1

@mariosant
Copy link
Contributor

mariosant commented May 30, 2018

@joncursi can't seem to be able to reproduce the error. Any particular details?

~/P/normalize-url $ node -v
v10.2.1
~/P/normalize-url $ npm test

> [email protected] test /home/mariosant/Projects/normalize-url
> xo && ava


  index.js:8:18
  ⚠  8:18  Arrow function has a complexity of 22.  complexity

  1 warning

  9 passed

UPDATE

I think I am able to reproduce the error in browser environment. Error replicated at https://repl.it/@mariosant/300-URL-is-not-a-constructor-60 .

@sindresorhus
Copy link
Owner

See: webpack/node-libs-browser#69

I guess we can do conditional checking here as URL is a global in Node.js 10 too.

@joncursi
Copy link
Author

@mariosant yep, I'm hitting this issue client-side in the latest Chrome browser.

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

Successfully merging a pull request may close this issue.

4 participants