Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(js): Fix ESM builds #1163

Merged

Conversation

cephalization
Copy link
Contributor

@cephalization cephalization commented Dec 9, 2024

  • Advertise ESM dist files in each package via package.json exports field
  • Create stub package.json files with "type": "module" in each esm dist folder, to let node know to use esm imports
  • Add tsc-alias tool to build process to update all relative imports in emitted esm dist files to adhere to ESM import specification requirements (add .js to all import extensions)

I tested newly emitted dist/ outputs for openinference-instrumentation-openai in an ESM only node project and we no longer get import related errors as we now correctly import esm code. However, auto-instrumentation itself does not yet work in ESM mode.

Resolves #1144

@cephalization cephalization requested a review from a team as a code owner December 9, 2024 17:09
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 9, 2024
@cephalization cephalization merged commit 16a3815 into main Dec 12, 2024
3 checks passed
@cephalization cephalization deleted the cephalization/js/1106-1144-expose-esm-builds-upgrade-ts branch December 12, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[feature request] Proper packaging for JS ESM builds
2 participants