-
-
Notifications
You must be signed in to change notification settings - Fork 746
fix(cli): devServer.hot: false not work
#12261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where setting devServer.hot: false in the configuration was ignored when using Rspack CLI. The fix ensures that the normalizeHotOption function properly respects the user's configuration instead of defaulting to true.
Key changes:
- Modified
normalizeHotOptionto return the value as-is if it's not a string, preventing unwanted defaults - Extracted default hot value to a constant (
DEFAULT_SERVER_HOT) for better maintainability - Added comprehensive test coverage for the disable HMR functionality
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/rspack-cli/src/commands/serve.ts |
Fixed normalizeHotOption logic to properly handle false values; refactored code for better readability with renamed variables and removed empty lines |
packages/rspack-cli/src/constants.ts |
Added DEFAULT_SERVER_HOT constant to centralize the default hot value |
packages/rspack-cli/tests/serve/disable-hot/serve-flags.test.ts |
Added new test to verify that HMR can be disabled via devServer.hot: false |
packages/rspack-cli/tests/serve/disable-hot/rspack.config.js |
Configuration file for the disable-hot test case |
packages/rspack-cli/tests/serve/disable-hot/src/index.js |
Sample entry file for the disable-hot test case |
packages/rspack-cli/tests/serve/flags/serve-flags.test.ts |
Changed it.concurrent to test for consistency (note: should be reverted) |
packages/rspack-cli/tests/serve/flags/rspack.config.js |
Refactored onListening from function expression to method shorthand |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
🙈 Size remains the same at 47.63MB |
CodSpeed Performance ReportMerging #12261 will not alter performanceComparing Summary
|
Summary
devServer.hot: falsenot work when using Rspack CLI, thenormalizeHotOptionmethod should not return true by default.Related links
devServer.hot: falsedoesn't disable HMR #12258Checklist