You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing @vitejs/devtools in a Vite+ project causes a Rolldown panic at build time:
Rolldown panicked. This is a bug in Rolldown, not your code.
thread '<unnamed>' panicked at tracing-subscriber-0.3.23/src/util.rs:94:14:
failed to set global default subscriber: SetGlobalDefaultError("a global default trace dispatcher has already been set")
The panic fires before any plugin runs — simply having import { DevTools } from "@vitejs/devtools" at the top of vite.config.ts is enough to trigger it, even if DevTools() is never added to plugins.
Root cause (as far as I can tell)
@vitejs/devtools transitively depends on @rolldown/debug, which ships its own Rolldown napi binary. @voidzero-dev/vite-plus-core statically bundles Rolldown into a single napi binary (per @fengmk2's note in #1285: "we packaged rolldown with vite-plus's napi-rs into a single binary").
Both binaries load into the same Node process and each tries to install a global tracing_subscriber. The second one loses and panics.
This looks like exactly the class of problem discussed in:
Commenting out DevTools() and build.rolldownOptions.devtools but leaving the import in place still panics — confirming it's a side-effect of loading the napi binary, not plugin registration.
Fully removing the import (and the package) lets the build succeed.
Would it make sense for vite-plus-core to alias/shim @rolldown/debug to the bundled Rolldown instance (similar to how vite and vitest are aliased via npm overrides), so there's only ever one napi binary in the process?
Should the DevTools getting-started guide at https://devtools.vite.dev/guide/ note the Vite+ incompatibility until this is fixed?
Summary
Importing
@vitejs/devtoolsin a Vite+ project causes a Rolldown panic at build time:The panic fires before any plugin runs — simply having
import { DevTools } from "@vitejs/devtools"at the top ofvite.config.tsis enough to trigger it, even ifDevTools()is never added toplugins.Root cause (as far as I can tell)
@vitejs/devtoolstransitively depends on@rolldown/debug, which ships its own Rolldown napi binary.@voidzero-dev/vite-plus-corestatically bundles Rolldown into a single napi binary (per @fengmk2's note in #1285: "we packaged rolldown with vite-plus's napi-rs into a single binary").Both binaries load into the same Node process and each tries to install a global
tracing_subscriber. The second one loses and panics.This looks like exactly the class of problem discussed in:
disable_panic_hookfeature to disable the panic hook rolldown/rolldown#9023 — gate Rolldown's panic/tracing hook behind a feature flag…but specifically manifesting through the
@rolldown/debug→@vitejs/devtoolsdependency chain, rather than through Vite+'s own bundled copy alone.Reproduction
Fresh project on Vite+
0.1.16:vite.config.ts:vp build→ panic above.Commenting out
DevTools()andbuild.rolldownOptions.devtoolsbut leaving theimportin place still panics — confirming it's a side-effect of loading the napi binary, not plugin registration.Fully removing the
import(and the package) lets the build succeed.Dependency tree (relevant slice)
Environment
vpv0.1.16Questions
@vitejs/devtoolswith Vite+, or is the expectation that users drop it until the panic-hook gating in feat(rust): adddisable_panic_hookfeature to disable the panic hook rolldown/rolldown#9023 lands and Vite+ consumes it?vite-plus-coreto alias/shim@rolldown/debugto the bundled Rolldown instance (similar to howviteandvitestare aliased via npm overrides), so there's only ever one napi binary in the process?Happy to test patches / prereleases.