jhurliman / node-rate-limiter

A generic rate limiter for node.js. Useful for API clients, web crawling, or other tasks that need to be throttled
MIT License
1.51k stars 135 forks source link

Enable ES Module usage #89

Closed benschwarz closed 2 years ago

benschwarz commented 2 years ago

As noted in #80, es module imports are currently broken on the 2.1.0 release.

According to the node docs, the package.json module field is ignored. Instead, an ES module can be signified using "type": "module".

In this PR:

benschwarz commented 2 years ago

@jhurliman It looks like we'll need a similar change to just-performance too. Did you want me to go ahead and update that as well?

nigelis commented 2 years ago

@benschwarz Adding "type": "module" makes this module not importable by other commonjs modules, as I tested locally.

The change to remove "type": "module" is introduced in #79 . I think the real problem is that the module is not built properly to support esm and cjs at the same time.