Skip to content

Add an ESM build to template-sdk - #1485

Open
shubhamkapoor01 wants to merge 1 commit into
livekit:mainfrom
shubhamkapoor01:fix/template-sdk-esm
Open

shubhamkapoor01 wants to merge 1 commit into
livekit:mainfrom
shubhamkapoor01:fix/template-sdk-esm

Conversation

@shubhamkapoor01

@shubhamkapoor01 shubhamkapoor01 commented Oct 25, 2026 •

Copy link
Copy Markdown

The SDK only ships CommonJS, so in a "type": "module" app Vite 8, bun build and webpack 5 return the whole module for the default import, and EgressHelper.getLiveKitURL is undefined. This adds an ESM build in dist/esm plus an exports map, and require() still gets the same CommonJS files. Tested the packed SDK in Vite 8, bun and webpack 5 apps (undefined before, a function after) and with require().

Bumped to 0.3.0, since the exports map closes deep imports like @livekit/egress-sdk/dist/index.js, and code that hard-coded .default as a workaround now gets undefined.

The ESM and CommonJS builds are separate copies, so an app that both imports and requires the SDK would get two copies of its room state; templates import it once, so I kept the build simple. template-default installs the SDK from npm, so its CI won't exercise this until 0.3.0 is published, and I can send that bump after the release.

Fixes #1286

@shubhamkapoor01
shubhamkapoor01 requested a review from a team as a code owner October 25, 2026 13:33

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant