Skip to content

Conversation

yukitaka
Copy link

Summary

  • Fixed an issue where basePath was not correctly applied in dev mode for the root index route
  • The dev server now uses root path "/" while preserving the configured basePath for the main app

Test plan

  • Test that routes work correctly with basePath in dev mode
  • Verify root index route loads properly with basePath configuration
  • Ensure no regression in normal dev mode without basePath
  • Ran deno task ok - all tests pass except one unrelated vite dev test that appears to be flaky

@yukitaka
Copy link
Author

I've identified the test failure. The builder_test.ts error is caused by the change in how dev config is handled. Working on a fix now.

@yukitaka
Copy link
Author

Fixed the test failures!

The solution:

  1. Set devApp's basePath to "" to simplify routing in dev mode
  2. Added displayBasePath option to ListenOptions to show the correct basePath in startup messages
  • This extends the App class's listen method, but only affects the display message
  • Alternative would be to handle this entirely within builder.ts if preferred
  1. Simplified dev middleware URL checks since basePath is always "" in dev mode
  2. Added test case to catch this issue in the future

All tests now pass. The dev server correctly handles accessing the root index at `/test` when basePath is configured.

Note: I extended ListenOptions with displayBasePath to cleanly separate the routing basePath from the display basePath. If you prefer a solution that doesn't modify the App class, I can refactor to handle this entirely within the dev builder.

When using a basePath, the dev server should handle routes correctly even for the root index.
This fix ensures that the dev app uses root path "/" while the main app keeps the configured basePath.
- Set devApp basePath to "/" for consistent routing
- Add displayBasePath option for correct startup message
- Simplify middleware URL checks
- Add regression test for basePath root index access
@yukitaka yukitaka force-pushed the fix-basepath-root-index branch from 9b6fb92 to 2daa513 Compare August 17, 2025 17:25
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