From 808d24b57d9da9d1eeaaa5eda89b0e2288fc1d7c Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Tue, 25 Nov 2025 14:52:53 +0000 Subject: [PATCH] fix(demo): correct path resolution for ghostty-web package The findGhosttyWeb() function was incorrectly resolving the package root path. The regex /[/\\]dist[/\\].*$/ already strips the path down to the package root (e.g., '/path/to/node_modules/ghostty-web'), but then path.dirname() was called which removed one more directory level, resulting in '/path/to/node_modules' instead. This caused the 'Could not find ghostty-web package' error when running npx @ghostty-web/demo because it was looking for the WASM file and dist folder in node_modules/ instead of node_modules/ghostty-web/. Fixes the issue where npx @ghostty-web/demo@next fails with: Error: Could not find ghostty-web package. --- demo/bin/demo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demo/bin/demo.js b/demo/bin/demo.js index 6faebb5c..94f11a75 100644 --- a/demo/bin/demo.js +++ b/demo/bin/demo.js @@ -43,7 +43,8 @@ function findGhosttyWeb() { // Use require.resolve to find the installed ghostty-web package try { const ghosttyWebMain = require.resolve('ghostty-web'); - const ghosttyWebRoot = path.dirname(ghosttyWebMain.replace(/[/\\]dist[/\\].*$/, '')); + // Strip dist/... from path to get package root (regex already gives us the root) + const ghosttyWebRoot = ghosttyWebMain.replace(/[/\\]dist[/\\].*$/, ''); const distPath = path.join(ghosttyWebRoot, 'dist'); const wasmPath = path.join(ghosttyWebRoot, 'ghostty-vt.wasm');