#1513·opentui

Windows: 在 Node 下, Vitest 选择 Bun 导出无法加载 opentui.dll

作者: mynameistito创建于 2026年9月17日更新于 2026年9月17日

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 test The actual result: Error: Failed to initialize OpenTUI render library: Unknown file extension ".dll" for .../node_modules/@opentui/core-win32-x64/opentui.dll The stack points to `@opentui/core-win32-x64/index.bun.js`, which contains: const module = await import("./opentui.dll", { with: { type: "file" } }); The 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 `node` condition, or should the documentation call out that the Bun condition must only be used when Vitest itself runs under Bun? The 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 run

内容来源: anomalyco/opentui