fix(core): print fallback URL when HTML is disabled#7534
Conversation
Deploying rsbuild with
|
| Latest commit: |
49ba24d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8f66af97.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://chenjiahan-fix-print-urls-fa.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR ensures the dev server still prints a useful URL when HTML generation is disabled (resulting in no HTML routes), by falling back to printing the server.base URL when at least one environment targets web. It also adds a regression test and updates the English/Chinese docs accordingly.
Changes:
- Add a
fallbackPathnamemechanism soprintServerURLscan print a default route even whenroutesis empty. - In dev server startup, compute
fallbackPathnamefromserver.basewhen there are no HTML routes but at least onewebtarget exists. - Add a regression test and update docs (EN/ZH) describing the new behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/zh/config/server/print-urls.mdx | Documents the new fallback printing behavior when HTML is disabled. |
| website/docs/en/config/server/print-urls.mdx | Documents the new fallback printing behavior when HTML is disabled. |
| packages/core/tests/server.test.ts | Adds a regression test covering the fallback pathname printing. |
| packages/core/src/server/helper.ts | Extends printServerURLs to optionally synthesize a printable route from fallbackPathname. |
| packages/core/src/server/devServer.ts | Computes and passes fallbackPathname for web-targeted environments with no HTML routes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request ensures that the dev server prints a base URL even when no HTML routes are generated, such as in SSR or backend-integrated applications, provided a 'web' target is present. It introduces fallbackPathname logic in the dev server and helper functions, accompanied by unit tests and documentation updates. Feedback was provided to explicitly check for undefined when evaluating the fallback pathname to correctly handle cases where the server base might be an empty string.
Summary
server.baseURL when HTML generation is disabled and at least one environment targets the web