Closed wereHamster closed 2 years ago
I'm not sure if this change is worthwhile, it breaks older node version and provides nothing new? In general I'm not a fan of globals.
It makes it less specific to Node.js and more compatible with other runtimes (eg. Deno, Web/Cloudflare Workers etc). The other dependency that's specific to Node.js is fetch, but that API has just been added to Node.js v18, that's too recent to depend on.
Alternative could be to provide a «pure» version (import { unfurl } from "unfurl.js/pure"
) that uses global URL and fetch, parallel to the regular "unfurl.js" package which would continue to depend on Node.js specifics and node-fetch.
Thanks for the PR but I don't think we should have to worry about supporting runtimes like CF workers, deno, etc. This just doesn't seem worth it to me.
The global
URL
has been added in Node.js v10.This would be technically a breaking change, but I doubt people are still using Node.js older than v10. Version 12 is the oldest LTS at this moment.