open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client
https://opentelemetry.io
Apache License 2.0
2.65k stars 765 forks source link

Publish ESM packages following ESM spec #4898

Open JamieDanielson opened 1 month ago

JamieDanielson commented 1 month ago

Is your feature request related to a problem? Please describe.

Our packages currently publish directories of ESM builds, but they do not follow ESM spec and therefore cause problems for some end users trying to use them. For example, see issue #3989 .

Required (for each package) to fully support ESM

Maybe Required, otherwise Recommended

This (closed) PR can be used as a reference.

I would argue that we need a testing strategy in place to verify these changes, BEFORE we make any changes, as our current ESM tests cover a lot of ground but not the problems solved with this change. There are a few issues floating around I believe, but for now I will link #4008 to build out smoke / integration tests.

Related Issues that may be resolved with these changes:

david-luna commented 1 month ago

Hi @JamieDanielson

That's a pretty detailed list. Thanks! :) Is it a proposal or already has a consensus with other maintainers?

trentm commented 1 month ago
  • Change the package type to module in package.json

We don't need this step do we? If "exports" in package.json has the necessary "import" entries, then leaving empty or explicitly "type": "commonjs" should be fine.