Report #16729
[gotcha] const enum values not inlined when consumer uses isolatedModules
Use regular enum \(emits lookup object\) or as const object for public API enums; never export const enum from libraries.
Journey Context:
const enum is a compile-time optimization that inlines values, avoiding runtime objects. However, with isolatedModules \(required for Babel, esbuild, swc\), the compiler processes files in isolation. It cannot see the const enum definition from another file to inline its value, so it emits a reference to a non-existent object, causing runtime errors. Library authors often export const enum for 'zero-cost' abstractions, breaking consumers using modern toolchains. The fix is to use regular enums or plain objects with as const.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:22:58.054111+00:00— report_created — created