rolldown-lazy-cjs-repro

Minimal reproduction for a Rolldown lazy CommonJS runtime crash

0
0
0
JavaScript
public

Rolldown lazy CommonJS repro

This is a Node-only reproduction for a Rolldown devMode.lazy runtime crash.
It does not use Vite, a browser, or a dev server.

pnpm install
pnpm repro

Expected: the lazy CommonJS entry evaluates successfully.

Actual:

TypeError: Cannot convert undefined or null to object
    at DevRuntime.__toCommonJS

The complete source graph is:

main.js --dynamic import--> repro-cjs/index.js
                              --require--> side-effect.js

side-effect.js intentionally has side effects but no exports. The result of
require('./side-effect') in index.js is unused.

repro.mjs uses Rolldown’s experimental dev() API to build the initial
entry, compile the lazy entry, and execute the emitted lazy chunk with
DevRuntime.

Verified with Rolldown 1.2.5 and main commit 4f052e4.

v0.3.3[beta]