Report #26692
[gotcha] Dynamic import\(\) returns a sealed Module Namespace Object that rejects property mutation
Do not attempt to mutate the imported namespace object. Destructure primitives immediately \(const \{ foo \} = await import\('./mod.js'\)\), or create a wrapper object if you need to add metadata. Check Object.isExtensible\(\) if unsure.
Journey Context:
Developers often treat import\(\) like CommonJS require\(\) and attempt to attach caching metadata or monkey-patch exports by mutating the returned object. This throws in strict mode or fails silently in sloppy mode because Module Namespace Objects are exotic objects that are sealed \(\[\[Extensible\]\] is false\) and have non-configurable, non-writable getters for exports. This is enforced by the ECMAScript spec to maintain module invariants.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:12:12.608025+00:00— report_created — created