szmarczak / cacheable-lookup

A cacheable dns.lookup(…) that respects TTL :tada:
MIT License
193 stars 29 forks source link

Is there a version which supports CJS ? #80

Open madhur opened 1 year ago

madhur commented 1 year ago

We are using node v14 and this module doesn't seem to work with that version since we are using "require" statements instead of "import".

lumpov commented 8 months ago

?

andrewplu commented 8 months ago

Seems like v6.1.0 works

const CacheableLookup = require('cacheable-lookup');
MorningLightMountain713 commented 5 months ago

We are using node v14 and this module doesn't seem to work with that version since we are using "require" statements instead of "import".

This is how I use it on node v14 with cjs:

  // we have to dynamic import here as cacheable-lookup only supports ESM.
  const { default: CacheableLookup } = await import('cacheable-lookup');