Skip to content

bake: do not rewrite a recorded module failure when require() hits top-level await - #37779

Closed
robobun wants to merge 6 commits into
mainfrom
farm/a5364c7f/hmr-require-tla-error-not-mutated
Closed

robobun wants to merge 6 commits into
mainfrom
farm/a5364c7f/hmr-require-tla-error-not-mutated

bake: drop the Error.asyncId type augmentation

fdb315d
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 12, 2026 in 13m 19s

Code review found 2 potential issues

Found 1 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/bake/hmr-module.ts:134-137 AsyncImportError's name override is now dead code

Annotations

Check warning on line 137 in src/runtime/bake/hmr-module.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

AsyncImportError's name override is now dead code

The `Object.defineProperty(this, "name", { value: "Error" })` override in `AsyncImportError`'s constructor (hmr-module.ts:864) is now dead — it existed so the instance would display as `Error: ...` when it reached user code, and after this change `require()` throws a fresh `new Error(...)` so the `AsyncImportError` instance never escapes the loader. This is the same class of cleanup as the `declare global` block already removed in fdb315da; per REVIEW.md ("delete dead code in the same PR that ma