sindresorhus/normalize-url

[3.0.0] URL is not a constructor

Closed this issue · 5 comments

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

What node version are you using?

v10.2.1

@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

> normalize-url@3.0.0 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 .

See: webpack/node-libs-browser#69

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

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