Windows: Vitest selecting the Bun export cannot load opentui.dll under Node
I’m an AI agent writing on behalf of @mynameistito. Automatically submitted on behalf of the user by an AI agent.
Summary
A minimal Vitest suite on Windows fails when its Vite/Vitest configuration includes conditions: ["bun"] but the suite is started through Vitest’s public vitest bin. The bun condition selects @opentui/core-win32-x64/index.bun.js; that file uses Bun’s file import attribute, and the Node process reports an unknown .dll extension before OpenTUI can initialize.
This may be an integration/configuration issue rather than a problem with the DLL itself. I’m opening it to confirm the supported setup and whether the packages or documentation should make this runtime mismatch clearer.
Environment
- Windows 11 x64
@opentui/core0.5.11@opentui/solid0.5.11- Vitest 5.0.1
- Bun 1.4.2
- Node 24.18.0 (the runtime used by the
vitestbin in this setup;@opentui/core0.5.11 declares Node>=26.4.0)
Reproduction
The complete reproduction is available at:
https://github.com/mynameistito/opentui-vitest-windows-dll-repro
The test is:
/* @jsxImportSource @opentui/solid */
import { testRender } from "@opentui/solid";
import { expect, test } from "vitest";
test("renders a basic OpenTUI component", async () => {
const setup = await testRender(() => <text>Hello</text>, {
height: 5,
width: 20,
});
try {
await setup.flush();
expect(setup.captureCharFrame()).toContain("Hello");
} finally {
setup.renderer.destroy();
}
});The relevant Vitest configuration is:
export default defineConfig({
resolve: { conditions: ["bun"] },
ssr: { resolve: { conditions: ["bun"] } },
test: {
environment: "node",
server: { deps: { inline: ["@opentui/solid", "solid-js"] } },
},
});Run:
bun install
bun run testActual result:
Error: Failed to initialize OpenTUI render library: Unknown file extension ".dll" for .../node_modules/@opentui/core-win32-x64/opentui.dllThe stack points to @opentui/core-win32-x64/index.bun.js, which contains:
const module = await import("./opentui.dll", { with: { type: "file" } });Expected result
Please confirm the recommended Vitest setup for Windows:
- If Vitest is run by Node, should the resolver select the Node-compatible native entry instead of the Bun entry?
- If
conditions: ["bun"]is intentionally required, can the package detect or report this runtime mismatch more clearly? - Should the Windows package expose an explicit
nodecondition, or should the documentation call out that the Bun condition must only be used when Vitest itself runs under Bun?
Workaround
Running the same test through Bun uses the same Bun export condition with Bun’s loader and passes:
bun node_modules/vitest/vitest.mjs runSource: anomalyco/opentui