You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
require(esm): __esModule is not an own enumerable property (Object.keys omits it) #40340
Node.js documents that require() of an ES module with export default returns a namespace that includes an own enumerable __esModule: true, so CJS tooling that does Object.keys / Object.assign / object spread can see the interop marker.
On Bun, "__esModule" in mod and mod.__esModule === true both succeed, but Object.keys(mod) omits "__esModule". That matches a prototype getter / non-enumerable marker, not Node’s own enumerable property.
Save as repro.mjs and run node repro.mjs then bun repro.mjs:
Those PRs describe exactly this: the marker must be an own enumerable property on a null-prototype namespace, not a prototype getter. Opening this in case the canary does not yet include that change.
Reproduced on main at 861e9ae: Object.keys(mod) omits __esModule while "__esModule" in mod is true. Fix in progress: #33894 makes the marker an own enumerable property on a null-prototype namespace. It waits on a JSC-side change (oven-sh/WebKit#279).
Status update. #33894 is closed, and oven-sh/WebKit#279 with it. That design put the marker on the one namespace object that import also returns, so the marker leaked to the import side.
The design that matches Node: require() returns a second namespace object when the module has a default export and no __esModule export. __esModule is a real export of that object, so Object.keys, object spread and Object.assign see it. The import namespace keeps a null prototype and never shows the marker, which also covers #39866 and #21614.
It waits on two things:
A decision from a maintainer. For such a module require(x) !== await import(x), as in Node. Bun's docs say that both are the same object today.
Activity
robobun commentedon Aug 24, 2026
Reproduced on main at 861e9ae:
Object.keys(mod)omits__esModulewhile"__esModule" in modis true. Fix in progress: #33894 makes the marker an own enumerable property on a null-prototype namespace. It waits on a JSC-side change (oven-sh/WebKit#279).robobun commentedon Nov 7, 2026
Status update. #33894 is closed, and oven-sh/WebKit#279 with it. That design put the marker on the one namespace object that
importalso returns, so the marker leaked to the import side.The design that matches Node:
require()returns a second namespace object when the module has adefaultexport and no__esModuleexport.__esModuleis a real export of that object, soObject.keys, object spread andObject.assignsee it. The import namespace keeps a null prototype and never shows the marker, which also covers #39866 and #21614.It waits on two things:
require(x) !== await import(x), as in Node. Bun's docs say that both are the same object today.The closing comment on #33894 has the details.