segmentio / analytics-node

The hassle-free way to integrate analytics into any node application.

Home Page:https://segment.com/libraries/node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for other backend JS runtimes (Web Workers, Deno)

davidhousedev opened this issue · comments

We are hoping to dispatch backend events from Shopify's Hydrogen framework, which is deployed in Web Workers. Do you all have any plans to add a source that's compatible with JS web workers? This could also be applicable to other edge-enabled frameworks like NextJS and Remix.

Hi @davidhousedev! We are planning to add support for worker environments in analytics.js ... stay tuned as we should release this summer.

Now it is Autumn already... Do we have a more lightweight version for serverless, node and web workers?

I especially would appreciate fewer dependencies (ideally ZERO) for the node version.

@pooyaj and Segment team, do you have any updates on the support and ability to use this library in/with Web Workers?

@huksleyand @davidhousedev https://github.com/segmentio/analytics-next/tree/master/packages/node supports lambda.

Not tested yet, but it should not be hard to also support CF workers and web workers if it doesn't already, as it uses system fetch, and nothing else that should be node specific (there is a process.version reference that can be refactored, but that's it). If anyone has an interest in contributing / testing, it'd be much appreciated!

@segment/analytics-node now supports cloudflare workers (and presumably, other worker runtimes).