cli: resolve ws from package root

This commit is contained in:
Simon Klee
2026-07-16 11:53:02 +02:00
parent 68af4f7463
commit bfcee9872f
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -1,5 +1,6 @@
import path from "node:path"
import { readFile } from "node:fs/promises"
import { createRequire } from "node:module"
import { defineConfig, type Plugin, type UserConfig } from "vite"
import solid from "vite-plugin-solid"
import { nodeExecArgv, nodeTarget, type NodeTarget, photonWasmAsset } from "./src/node/target"
@@ -33,7 +34,10 @@ const resolve = {
alias: [
{ find: /^solid-js\/store$/, replacement: "solid-js/store/dist/store.js" },
{ find: /^solid-js$/, replacement: "solid-js/dist/solid.js" },
{ find: /^ws$/, replacement: path.resolve(dir, "node_modules/ws/wrapper.mjs") },
{
find: /^ws$/,
replacement: path.join(path.dirname(createRequire(import.meta.url).resolve("ws/package.json")), "wrapper.mjs"),
},
],
conditions: ["node"],
}
@@ -170,7 +170,7 @@ async function renderOnceSettled(app: Awaited<ReturnType<typeof testRender>>) {
async function captureSettledFrame(app: Awaited<ReturnType<typeof testRender>>) {
for (let attempt = 0; attempt < 5; attempt++) {
const frame = app.captureCharFrame()
if (frame.trim().length > 0) return frame
if (visibleLines(frame).length > 0) return frame
await new Promise((resolve) => setTimeout(resolve, 25))
await app.renderOnce()
}