@livekit/egress-sdk (0.2.1) ships CJS only — package.json has "main": "dist/index.js" with no exports map or ESM build, and dist/index.js uses exports.__esModule = true + exports.default = EgressHelper.
Bundlers with esbuild-style CJS interop (Rolldown — vite 8's default bundler — and bun build) bind import EgressHelper from "@livekit/egress-sdk" to the module namespace object instead of unwrapping .default, unlike Rollup/vite ≤ 7. Every method access then throws (EgressHelper.getLiveKitURL is not a function), so a custom room-composite template never emits START_RECORDING, and the egress aborts with Start signal not received — silently losing recordings, with nothing in the page console (a guard try/catch around the param getters swallows the TypeError). We hit this in production use the day Dependabot bumped vite 7 → 8.
Repro
// probe.ts
import EgressHelper from "@livekit/egress-sdk";
console.log(typeof (EgressHelper as any).getLiveKitURL, Object.keys(EgressHelper as any));
bun build probe.ts --target=browser (or vite build on vite 8 / Rolldown): undefined [ "default" ] ❌
- vite ≤ 7 (Rollup) or the Bun runtime:
function [ "getLiveKitURL", "getAccessToken", … ] ✅
The runtime-vs-bundler disagreement makes it particularly nasty: dev mode and tests pass, only the production bundle breaks, and the first observable symptom is EGRESS_ABORTED "Start signal not received" on the egress side.
Ask
Publish a dual ESM/CJS build — an exports map with an import condition is enough (the package is ~100 lines). Happy to send a PR to template-sdk/ if that helps.
Workaround for anyone else hitting this
import EgressHelperImport from "@livekit/egress-sdk";
const EgressHelper =
(EgressHelperImport as unknown as { default?: typeof EgressHelperImport }).default ??
EgressHelperImport;
@livekit/egress-sdk(0.2.1) ships CJS only —package.jsonhas"main": "dist/index.js"with noexportsmap or ESM build, anddist/index.jsusesexports.__esModule = true+exports.default = EgressHelper.Bundlers with esbuild-style CJS interop (Rolldown — vite 8's default bundler — and
bun build) bindimport EgressHelper from "@livekit/egress-sdk"to the module namespace object instead of unwrapping.default, unlike Rollup/vite ≤ 7. Every method access then throws (EgressHelper.getLiveKitURL is not a function), so a custom room-composite template never emitsSTART_RECORDING, and the egress aborts withStart signal not received— silently losing recordings, with nothing in the page console (a guardtry/catcharound the param getters swallows the TypeError). We hit this in production use the day Dependabot bumped vite 7 → 8.Repro
bun build probe.ts --target=browser(orvite buildon vite 8 / Rolldown):undefined [ "default" ]❌function [ "getLiveKitURL", "getAccessToken", … ]✅The runtime-vs-bundler disagreement makes it particularly nasty: dev mode and tests pass, only the production bundle breaks, and the first observable symptom is
EGRESS_ABORTED "Start signal not received"on the egress side.Ask
Publish a dual ESM/CJS build — an
exportsmap with animportcondition is enough (the package is ~100 lines). Happy to send a PR totemplate-sdk/if that helps.Workaround for anyone else hitting this