mistval / node-fetch-cache

Node-fetch with built-in response caching.
MIT License
55 stars 9 forks source link

ESM support #11

Closed talentlessguy closed 3 years ago

talentlessguy commented 3 years ago

A few months ago Node.js 10 reached EOL so it's safe to use ES module syntax, e.g. this:

import { fetchBuilder } from 'node-fetch-cache'

Is it planned to support it for node-fetch-cache? Either solely ESM or with combination of CJS fallback.

mistval commented 3 years ago

Hi, it should be possible to use it like this:

import fetchBuilder from 'node-fetch-cache'

const fetch = fetchBuilder.withCache(new fetchBuilder.MemoryCache());

Please let me know if you have any trouble with that.

talentlessguy commented 3 years ago

@mistval seems to be working, thx!