Skip to content
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

[Bug]: devServer's option true won't automatically apply HMR plugin #9663

Open
Lancernix opened this issue Mar 13, 2025 · 2 comments
Open

[Bug]: devServer's option true won't automatically apply HMR plugin #9663

Lancernix opened this issue Mar 13, 2025 · 2 comments
Assignees

Comments

@Lancernix
Copy link

System Info

System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1
Memory: 105.83 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
pnpm: 8.15.8 - /usr/local/bin/pnpm
Browsers:
Chrome: 134.0.6998.46
Safari: 18.2
npmPackages:
@rspack/cli: ^1.2.8 => 1.2.8
@rspack/core: ^1.2.8 => 1.2.8
@rspack/plugin-react-refresh: ^1.0.1 => 1.0.1

Details

In Webpack5, setting devServer.hot to true will automatically apply HMR plugin.

But in Rspack, setting devServer.hot to true doesn't seem to work, new HotModuleReplacementPlugin() must be added to plugins option to make HMR work properly. However this will result in a warning log: <w> [webpack-dev-server] "hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.

The behavior should be consistent, it seems to be a bug.

Image

Reproduce link

No response

Reproduce Steps

1、set devServer.hot to true
2、check if HMR is working
3、add HMR plugin
4、check if HMR is working
5、see dev-server log

@Lancernix Lancernix added the pending triage The issue/PR is currently untouched. label Mar 13, 2025
@LingyuCoder
Copy link
Contributor

I tried to create a repro, but got the same warning in both rspack-dev-server (pnpm run dev) and webpack-dev-server (pnpm run devw). The class of rspack-dev-server directly inherits from webpack-dev-server, so there should be no differences.

Since the logic of adding the plugin only takes effect when options.webSocketServer is enabled (enabled by default), you can debug whether this configuration is enabled in your scenario.

@LingyuCoder LingyuCoder added need reproduction and removed pending triage The issue/PR is currently untouched. labels Mar 20, 2025
Copy link
Contributor

Hello @Lancernix, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants