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
[parity] import * as ns — ns.default is undefined for native modules whose default is the namespace itself #8236
Split out of #6766 after PR #8229. Not a perf_hooks bug — perf_hooks is just where the node-suite pins it.
import * as ns from "node:<mod>" should expose ns.default (Node lists it among the namespace keys, and it is the CJS module.exports). For perf_hooks the key is now listed but the read is undefined:
import*ashooksfrom"node:perf_hooks";Object.keys(hooks)// ✅ includes "default" after #8229hooks.default// ❌ undefinedhooks.default.performance===hooks.performance// node: true// perry: TypeError: Cannot read properties of undefined (reading 'performance')
Pinned by test-parity/node-suite/perf_hooks/imports/namespace-keys (line 1 passes, line 2 does not). Reproduce with ./run_parity_tests.sh --suite node-suite --module perf_hooks.
What I found
cjs_default_export_value("perf_hooks") in crates/perry-runtime/src/object/native_module.rs now returns the module namespace (added in #8229), and get_native_module_constant has a generic property == "default" branch ahead of its per-module match that consults it. Despite that, the read still resolves to undefined, so the PropertyGet { NativeModuleRef(mod), "default" } lowering — js_native_module_esm_export_value → native_module_property_by_name_impl(…, /* is_cjs */ false) — appears to return before either is reached. I did not chase it further.
Worth checking against the modules that resolve default through the separate <mod>.default tag machinery (cjs_default_namespace_name: os, path, util, url, …) — those may work by a different route, which would make this specifically about modules whose default is the namespace itself (dgram, perf_hooks).
changed the title [-][parity] — ns.default is undefined for native modules whose default is the namespace itself[/-][+][parity] import * as ns — ns.default is undefined for native modules whose default is the namespace itself[/+]on Aug 16, 2026
Activity
[-][parity] — ns.default is undefined for native modules whose default is the namespace itself[/-][+][parity] import * as ns — ns.default is undefined for native modules whose default is the namespace itself[/+]