evanderkoogh / otel-cf-workers

An OpenTelemetry compatible library for instrumenting and exporting traces for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
208 stars 39 forks source link

RFC: Removing CommonJS support #117

Open DaniFoldi opened 2 months ago

DaniFoldi commented 2 months ago

Hi people,

I and @jahands were thinking about simplifying the build toolchain of the library. Without going too much into the details of how it works, essentially the current setup creates an entirely different version for esm and cjs.

With most workers these days written using the Module Worker syntax, and with esbuild, I believe that the added package size and build complexity it not worth keeping in the lib. If you're currently using Service Worker syntax, I highly recommend following [https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/#migrate-from-service-workers-to-es-modules](Cloudflare's guide) to migrate - you're losing out on features like JSRPC, Durable Objects, D1 and probably more.

The question to anyone watching the repo, or finding this issue randomly, do you actually use cjs in your workers and need continued support?