rolldown-lazy-circular-reexport-repro

Minimal reproduction for a Rolldown lazy dev-mode circular re-export bug

0
0
0
JavaScript
public

Rolldown lazy circular re-export repro

This reproduces an evaluation-order bug in Rolldown’s experimental lazy dev
mode. A module re-exports a binding and another module in the same cycle reads
that binding during module evaluation.

Reproduction

pnpm install
pnpm native
pnpm repro

pnpm native succeeds and prints:

{ exampleResult: 'ok', publicValue: 'ok' }

pnpm repro fails while evaluating the lazy payload:

TypeError: Cannot read properties of undefined (reading 'value')

The generated factory for index.js registers export getters, initializes
value.js, and then initializes example.js. However, the generated variable
used by the publicValue getter is assigned only after example.js finishes.
Because example.js calls publicValue() while the cycle is being evaluated,
the getter reads that still-undefined variable.

The dependency is pinned to the pkg.pr.new build for Rolldown PR #10772 at
commit 224f40b.

v0.3.3[beta]