Skip to content

fix(init): restore ?bridge=1 cache-bust for dev mode#934

Merged
MathurAditya724 merged 1 commit intomainfrom
fix/init-ink-dev-mode-cache
May 8, 2026
Merged

fix(init): restore ?bridge=1 cache-bust for dev mode#934
MathurAditya724 merged 1 commit intomainfrom
fix/init-ink-dev-mode-cache

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

#929 removed the ?bridge=1 query string from the dynamic import of ink-app.tsx because /$bunfs/ paths don't support query strings (ENOENT). However, in dev mode (bun run dev), the with { type: "file" } import returns a raw filesystem path, and Bun's module loader caches the path-string result under the same specifier key as a regular module import. A bare await import(inkAppPath) returns { default: "/abs/path" } instead of the module's actual exports, causing mountApp to be undefined and the Ink UI to fail to load.

Fix: conditionally append ?bridge=1 only when the path is NOT under /$bunfs/. In compiled binaries the cache collision doesn't occur, and /$bunfs/ paths work without query strings. In dev mode the filesystem path supports query strings and the cache-bust is needed.

Testing

  • bun run dev -- init renders the Ink TUI correctly in dev mode
  • Compiled binary (bun run build --single) still works
  • bun run typecheck passes
  • All 6835 unit tests pass

In dev mode (not compiled), `with { type: "file" }` caches the path
string under the same module key. A bare `import(inkAppPath)` returns
`{ default: "/abs/path" }` instead of the module's exports. The
`?bridge=1` query forces a distinct cache key so the .tsx evaluates
as a module.

In compiled binaries `/$bunfs/` paths don't support query strings
(ENOENT), but the cache collision doesn't occur there either.

Conditional: append `?bridge=1` only when NOT under `/$bunfs/`.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-934/

Built to branch gh-pages at 2026-05-08 14:22 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Codecov Results 📊

6836 passed | Total: 6836 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 13915 uncovered lines.
✅ Project coverage is 77.04%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    77.04%    77.04%        —%
==========================================
  Files          317       317         —
  Lines        60600     60598        -2
  Branches         0         0         —
==========================================
+ Hits         46687     46683        -4
- Misses       13913     13915        +2
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon marked this pull request as ready for review May 8, 2026 14:25
@MathurAditya724 MathurAditya724 enabled auto-merge (squash) May 8, 2026 14:26
@MathurAditya724 MathurAditya724 merged commit 7d80d25 into main May 8, 2026
24 checks passed
@MathurAditya724 MathurAditya724 deleted the fix/init-ink-dev-mode-cache branch May 8, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant