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

punycode exports nothing if global AMD define is present #7224

Closed
andyearnshaw opened this issue Jun 8, 2016 · 3 comments
Closed

punycode exports nothing if global AMD define is present #7224

andyearnshaw opened this issue Jun 8, 2016 · 3 comments

Comments

@andyearnshaw
Copy link

If an AMD loader is defined on global, the punycode module no longer exports something if required with Node's require():

> global.define = function () {}
[Function]
> global.define.amd = {}
{}
> require('punycode')
{}

In particular, this affects Url.prototype.parse() method, which has a dependency on punycode.toASCIII().

> require('url').parse('http://foo.bar/baz')
TypeError: punycode.toASCII is not a function
    at Url.parse (url.js:312:32)
    at Object.urlParse [as parse] (url.js:73:5)
    at repl:1:16
    at REPLServer.defaultEval (repl.js:272:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:441:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:188:7)
    at REPLServer.Interface._onLine (readline.js:224:10)
@cjihrig
Copy link
Contributor

cjihrig commented Jun 8, 2016

Node core grabs punycode as is from https://github.com/bestiejs/punycode.js/. You might want to consider opening an issue there.

@andyearnshaw
Copy link
Author

I figured as much but thought it might be a good idea to track the problem on both projects.

@mathiasbynens
Copy link
Contributor

Patch that updates to Punycode.js v2.0.0, which only exports to module.exports: #7267

Fishrock123 pushed a commit that referenced this issue Jun 27, 2016
Punycode v2.0.0 drops support for old and non-Node environments.

PR-URL: #7267
Fixes: #7224
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Fishrock123 pushed a commit that referenced this issue Jul 5, 2016
Punycode v2.0.0 drops support for old and non-Node environments.

PR-URL: #7267
Fixes: #7224
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
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.

3 participants