mapbox / node-pre-gyp

Node.js tool for easy binary deployment of C++ addons
BSD 3-Clause "New" or "Revised" License
1.11k stars 260 forks source link

node-fetch version upgrade #698

Closed Vhndaree closed 10 months ago

Vhndaree commented 11 months ago

Fixes https://github.com/mapbox/node-pre-gyp/issues/697

Vhndaree commented 11 months ago

Hi @marck283 Thanks, that is a great idea but node-fetch changed to ES modules by default from v3 so if we want to stick with the similar pattern of require() then it is not possible at the moment. So, I am sticking with v2.7.

marck283 commented 11 months ago

I understand your point but consider that solving the MaxListenersExceededWarning warning will lead to less memory usage. As shown in these test runs (taken from here):

When it comes to the require() pattern, Node.js users that run on version 13.2 and above can import the module by using the dynamic import instruction. This is why I think you should change the require() instructions to dynamic imports, so users that run on versions of Node.js below 13.2 should be able to import this module using the standard require(). Furthermore, by using the dynamic import instructions you can upgrade the node-fetch package this module runs on to its latest version. To allow the usage of the dynamic imports, however, you will have to change something in the files containing the TypeScript compilation settings. For example, the file tsconfig.json should be modified as this (changing the file extension back to JSON): tsconfig.txt

JasonMan34 commented 10 months ago

I created a PR that bumps minor versions across all dependencies including node-fetch