browserify / browserify/browserify

Please update your package.json to use the latest punycode module 2.0.0 ASAP

Open
#1,631 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.7k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I hit a problem I spent hours on today with this code
require([], function(

require('mapbox-gl')
))

When mapbox at some point calls punycode.toAscii i get error function not defined
this is because of some kind of race condition where var punycode = require('punycode') gets called before the object is actually set.

```
/** Expose `punycode` */
// Some AMD build optimizers, like r.js, check for specific condition patterns
// like the following:
// if (
// typeof define == 'function' &&
// typeof define.amd == 'object' &&
// define.amd
// ) {
// define('punycode', function() {
// return punycode;
// });
// } else if (freeExports && freeModule) {
// if (module.exports == freeExports) {
// // in Node.js, io.js, or RingoJS v0.8.0+
freeModule.exports = punycode;
// } else {
// // in Narwhal or RingoJS v0.7.0-
// for (key in punycode) {
// punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
// }
// }
// } else {
// in Rhino or a web browser
// root.punycode = punycode;
// }
```

This piece of the code which I had to comment out, causes the problem

I attached a simple websphere project you can see the issue with

you'll need to run this command on it:
browserify mapboxexample.js -o output.js

[MapboxProject.zip](https://github.com/substack/node-browserify/files/502233/MapboxProject.zip)
in punycode module 2.0.0 this piece of code has been removed and that issue is resolved.
tested by replacing current node module for punycode in browserify to punycode 2.0.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.