Skip to content

SetGlobalDefaultError panic when @vitejs/devtools is imported alongside @voidzero-dev/vite-plus-core #1356

@nikolailehbrink

Description

@nikolailehbrink

Summary

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:

…but specifically manifesting through the @rolldown/debug@vitejs/devtools dependency chain, rather than through Vite+'s own bundled copy alone.

Reproduction

  1. Fresh project on Vite+ 0.1.16:

    "devDependencies": {
      "@vitejs/devtools": "0.1.13",
      "vite": "npm:@voidzero-dev/vite-plus-core@0.1.16",
      "vite-plus": "0.1.16",
      "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.16"
    },
    "overrides": {
      "vite": "npm:@voidzero-dev/vite-plus-core@0.1.16",
      "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.16"
    }
  2. vite.config.ts:

    import { DevTools } from "@vitejs/devtools";
    import { defineConfig } from "vite-plus";
    
    export default defineConfig({
      plugins: [DevTools()],
      build: {
        rolldownOptions: {
          devtools: {},
        },
      },
    });
  3. vp build → panic above.

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.

Dependency tree (relevant slice)

@voidzero-dev/vite-plus-core@0.1.16   (bundled rolldown rc.13)
@vitejs/devtools@0.1.13
 └── @vitejs/devtools-rolldown@0.1.13
      └── @rolldown/debug@1.0.0-rc.15   (second rolldown napi)

Environment

  • vp v0.1.16
  • Reported tools: vite v8.0.5, rolldown v1.0.0-rc.13, vitest v4.1.2
  • Node.js v24.14.1
  • Bun 1.3.11
  • macOS (darwin-arm64)
  • Framework: React Router 7 framework mode

Questions

  1. Is there a supported path today to use @vitejs/devtools with Vite+, or is the expectation that users drop it until the panic-hook gating in feat(rust): add disable_panic_hook feature to disable the panic hook rolldown/rolldown#9023 lands and Vite+ consumes it?
  2. 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?
  3. Should the DevTools getting-started guide at https://devtools.vite.dev/guide/ note the Vite+ incompatibility until this is fixed?

Happy to test patches / prereleases.

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions