browserify / node-util

node.js util module as a module
MIT License
247 stars 88 forks source link

Avoid multiple declarations of `fn` in promisify #73

Closed TomAFrench closed 2 years ago

TomAFrench commented 2 years ago

I'm having some issues with using this package in swc-loader which stems from the below lines.

https://github.com/browserify/node-util/blob/a292d8a73ac877cc9a0ae64b287cc064dcbacb54/util.js#L616-L629

We've got two declarations of fn here which share the same scope (despite the fact that we can only encounter one of them) and this is triggering a build error as a result.

Failing CI build demonstrating this here

As we're restricted to var in order to support ES5, I've renamed one of these instances of fn to something that seems reasonable.

ljharb commented 2 years ago

I’d file that bug with swc; this is perfectly valid code.

TomAFrench commented 2 years ago

Fair enough, thanks. :+1: