Minimal Vite 6 / Rollup repro. Open the browser console to see the full error. See README.md for analysis and the upstream issue report text.
import("jsroot")
Rollup bundles jsroot, evaluating ObjectPainter.mjs
before core.mjs has set internals.
Line 1828 throws TypeError: can't access property "jsroot" of
undefined.
Click the button to try…
<script> tag
jsroot's own pre-built jsroot.min.js is loaded via a
<script> tag. jsroot's own Rollup build uses the
correct evaluation order — no bundler involved.
Click the button to try…
jsroot has a circular dependency between its own modules:
main.mjs → core.mjs main.mjs → ObjectPainter.mjs → core.mjs ← circular
At the top level of ObjectPainter.mjs (line 1828):
// ObjectPainter.mjs:1828 — runs at module evaluation time
Object.assign(internals.jsroot, { ObjectPainter, cleanup, resize });
internals is imported from core.mjs.
When Rollup linearises the circular dependency it must pick an order.
In jsroot 7.10.3 the order happened to be correct.
jsroot 7.11.0 added import('@resvg/resvg-js') in
BasePainter.mjs for Node.js PNG support.
Since @resvg/resvg-js is a native .node
binary, browser projects must alias it to a stub — otherwise
the build fails outright. That alias introduces a cross-package import
(node_modules/jsroot → src/shims/) that changes Rollup's
chunk-split decisions and alters the module evaluation order, causing
ObjectPainter.mjs to be evaluated before
core.mjs.