-
Notifications
You must be signed in to change notification settings - Fork 699
Description
Reproduction link or steps
import { watch } from 'rolldown';
await watch({ input: 'main.js', experimental: {hmr: true }});Run:
> echo 'console.log(1)' > main.js
> node watch.js &
> cat dist/main.js
//#region rolldown:runtime
...
//#endregion
//#region rolldown:hmr
...
//#endregion
//#region main.js
var main_exports = {};
const main_hot = __rolldown_runtime__.createModuleHotContext("main.js");
__rolldown_runtime__.registerModule("main.js", { exports: main_exports });
console.log("1");
//#endregion
> echo 'console.log(2)' > main.js
thread 'tokio-runtime-worker' panicked at crates/rolldown/src/stages/scan_stage.rs:73:35:
internal error: entered unreachable code: Please normalized first
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: internal error: entered unreachable code: Please normalized first] {
code: 'GenericFailure'
}
Node.js v22.17.0
[1] + exit 1 node watch.jsWhat is expected?
Should not crash
What is actually happening?
I believe that after the first build the incremental-build cache is moved into the HMR manager.
On the next watcher cycle the bundler tries to perform an incremental (partial) scan, but the
ScanStageCache is empty, so merge is called without a snapshot and immediately converts
ScanStageOutput into NormalizedScanStageOutput.
That conversion expects a dense HybridIndexVec::IndexVec, but a partial scan always returns
HybridIndexVec::Map, triggering the unreachable!("Please normalized first") here: https://github.com/rolldown/rolldown/blob/main/crates/rolldown/src/stages/scan_stage.rs#L73
System Info
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M1 Pro
Memory: 124.58 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.0 - ~/.asdf/cache/installs/nodejs/22.17.0/bin/node
npm: 10.9.2 - ~/.asdf/cache/plugins/nodejs/shims/npm
pnpm: 10.10.0 - ~/.asdf/cache/shims/pnpm
bun: 1.1.36 - ~/.bun/bin/bun
Browsers:
Chrome: 138.0.7204.94
Safari: 18.5Any additional comments?
No response
Reactions are currently unavailable