It also would make an eventual migration to Node's built-in fetch easy as you could simply drop the import and use the one from Node
Describe alternatives you've considered
It would be nice to use fetch directly from Node. However, doing so requires Node 18 and this library still supports Node 15. Could we drop support for EOL versions of Node?
Related sub-libraries
[ ] All of them
[ ] posthog-web
[x] posthog-node
[ ] posthog-react-native
Additional context
Thank you for your feature request – we love each and every one!
@benmccann thanks for the suggestion.
You can replace the fetch function to not use the global fetch nor axios by setting this function if you wish for now.
Is your feature request related to a problem?
axios
is a somewhat weighty dependency and doesn't adhere to thefetch
standardhttps://npmgraph.js.org/?q=axios
Describe the solution you'd like
Switch to
undici
.undici
is the officialfetch
implementation bundled with Node.js. This should be an easy change asfetch
is already used where available: https://github.com/PostHog/posthog-js-lite/blob/4fe4eb2aa5da5ec57f39481e57a712c6992991b4/posthog-node/src/fetch.ts#L17C10-L17C15It also would make an eventual migration to Node's built-in fetch easy as you could simply drop the import and use the one from Node
Describe alternatives you've considered
It would be nice to use
fetch
directly from Node. However, doing so requires Node 18 and this library still supports Node 15. Could we drop support for EOL versions of Node?Related sub-libraries
Additional context
Thank you for your feature request – we love each and every one!