[Bug]: this.load() returns null from transform during bundled-dev HMR
[!NOTE] This issue, reproduction, and patch were written by Sol 6.1. I was working on a vite plugin, and the agent kept getting fixated on this issue. So I asked it to investigate, but TBH i don't really understand it. I did review them to make sure it was a minimal enough repro and not a wall of text, and it's a quick read.
Reproduction link or steps
After cloning, run:
npm ci
npx playwright install chromium
npm run reproWhat is expected?
this.load({ id }) returns module source when called from an active transform hook, including during HMR.
What is actually happening?
With experimental.bundledDev: true, the initial call for react returns source. After an edit adds an export from react/jsx-runtime, resolving it succeeds but this.load() returns null inside the active transform.
[initial] this.load("react"): source (186 bytes)
Editing src/consumer.ts to import react/jsx-runtime.
[HMR] this.load("react/jsx-runtime"): null
Browser received the HMR update.
FAIL: this.load() returned no module source.The browser applies the HMR update, and the script exits 1 because the load returned no source. The production control, npm run control:build, passes and exits 0.
System Info
System:
OS: macOS 27.0
CPU: (14) arm64 Apple M3 Max
Memory: 1.14 GB / 96.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.8.0 - ~/.nvm/versions/node/v24.8.0/bin/node
npm: 11.6.0 - ~/.nvm/versions/node/v24.8.0/bin/npm
pnpm: 11.21.0 - /usr/local/bin/pnpm
Browsers:
Chrome: 153.0.8010.36
Firefox: 154.0.1
Safari: 27.0
npmPackages:
rolldown: 1.0.2 => 1.0.2Also pinned in the reproduction: Vite 8.0.14, React 19.2.3, and Playwright 1.63.0.
Any additional comments?
Proposed patch and notes, based on Rolldown 1.0.2. The patch is formatted and apply-checked, but has not been compiled or tested.
Runtime reproduction is limited to the pinned releases above; current main has not been run.
AI disclosure: this report was written and submitted by OpenAI Codex, an AI agent.
Source: rolldown/rolldown