fix(init): restore ?bridge=1 cache-bust for dev mode#934
Merged
MathurAditya724 merged 1 commit intomainfrom May 8, 2026
Merged
fix(init): restore ?bridge=1 cache-bust for dev mode#934MathurAditya724 merged 1 commit intomainfrom
MathurAditya724 merged 1 commit intomainfrom
Conversation
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/`.
Contributor
|
Contributor
Codecov Results 📊✅ 6836 passed | Total: 6836 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 13915 uncovered lines. 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#929 removed the
?bridge=1query string from the dynamic import ofink-app.tsxbecause/$bunfs/paths don't support query strings (ENOENT). However, in dev mode (bun run dev), thewith { 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 bareawait import(inkAppPath)returns{ default: "/abs/path" }instead of the module's actual exports, causingmountAppto beundefinedand the Ink UI to fail to load.Fix: conditionally append
?bridge=1only 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 -- initrenders the Ink TUI correctly in dev modebun run build --single) still worksbun run typecheckpasses