Environment
- Bun: 1.3.14
- React: 19.x
- React Router: 8.0.0
- @opentui/core: 0.4.1
- @opentui/react: 0.4.1
- OS: Windows
Description
When running the application using bun run, everything works as expected.
However, after compiling the application into a standalone executable using:
bun build --compile src/index.tsx --outfile dist/my-app
the application crashes whenever navigation occurs using a Data Router created with createMemoryRouter.
The crash happens immediately after calling:
The destination route does not need to exist. The same crash occurs even if /foo is not defined.
The stack trace ends with:
Error: Text must be created inside of a text node
at createTextInstance
...
What I've verified
- Initial application render works.
- OpenTUI components (
Box, Text, ScrollBox) render correctly.
useState-based page switching works correctly.
navigate("/") does not crash.
navigate("/foo") crashes.
- Removing the destination component does not change the behavior.
- The crash only occurs in the compiled executable.
- The same application works correctly with
bun run and bun link.
Additional finding
Replacing the Data Router:
const router = createMemoryRouter(...);
<RouterProvider router={router} />
with the classic router:
<MemoryRouter>
<Routes>...</Routes>
</MemoryRouter>
completely resolves the issue.
Navigation works correctly in both development and the compiled executable.
Expected behavior
Navigation using createMemoryRouter should work identically in both bun run and a Bun standalone executable.
Actual behavior
Any navigation away from the current route causes the standalone executable to crash with:
Error: Text must be created inside of a text node
while the same code works correctly in development.
Environment
Description
When running the application using
bun run, everything works as expected.However, after compiling the application into a standalone executable using:
the application crashes whenever navigation occurs using a Data Router created with
createMemoryRouter.The crash happens immediately after calling:
The destination route does not need to exist. The same crash occurs even if
/foois not defined.The stack trace ends with:
What I've verified
Box,Text,ScrollBox) render correctly.useState-based page switching works correctly.navigate("/")does not crash.navigate("/foo")crashes.bun runandbun link.Additional finding
Replacing the Data Router:
with the classic router:
completely resolves the issue.
Navigation works correctly in both development and the compiled executable.
Expected behavior
Navigation using
createMemoryRoutershould work identically in bothbun runand a Bun standalone executable.Actual behavior
Any navigation away from the current route causes the standalone executable to crash with:
while the same code works correctly in development.