rsbuild icon indicating copy to clipboard operation
rsbuild copied to clipboard

[Bug]: HMR breaks after a couple of saves

Open DasPoet opened this issue 8 months ago โ€ข 0 comments

Version

System:
OS: Linux 5.15 cpe:/o:nixos:nixos:24.11 24.11 (Vicuna)
CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13950HX
Memory: 27.61 GB / 31.19 GB
Container: Yes
Shell: 5.9 - /run/current-system/sw/bin/zsh

npmPackages:
@rsbuild/core: ^1.3.1 => 1.3.14
@rsbuild/plugin-react: ^1.1.1 => 1.3.0

Details

Hey there ๐Ÿ‘‹,

first of all, many thanks for making this awesome project. I have come to very much appreciate how lightweight and fast rsbuild is.

However, I recently switched my development environment to WSL. Since then, I have repeatedly faced issues where, after making a couple of changes to my projects, hmr just stops working. See below for steps to reproduce this.

Reproduce link

https://github.com/DasPoet/rsbuild-repro

Reproduce Steps

Create an empty rsbuild project.

npm create rsbuild@latest
cd repro
npm i

Then, start a dev server

npm run dev

While the dev server is running, make changes to the App.tsx and observe the following error:

ร— Module not found: Can't resolve './App' in '/home/daspoet/projects/issues/repro/src'
   โ•ญโ”€[4:16]
 2 โ”‚ import React from 'react';
 3 โ”‚ import ReactDOM from 'react-dom/client';
 4 โ”‚ import App from './App';
   ยท                 โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 5 โ”‚ const rootEl = document.getElementById('root');
 6 โ”‚ if (rootEl) {
   โ•ฐโ”€โ”€โ”€โ”€
  help: Found module './App.tsx~'. However, it's not possible to request this module without the extension
        if its extension was not listed in the `resolve.extensions`. Here're some possible solutions:

        1. add the extension `".tsx~"` to `resolve.extensions` in your rspack configuration
        2. use './App.tsx~' instead of './App'

        Found module './App.css'. However, it's not possible to request this module without the extension
        if its extension was not listed in the `resolve.extensions`. Here're some possible solutions:

        1. add the extension `".css"` to `resolve.extensions` in your rspack configuration
        2. use './App.css' instead of './App'

DasPoet avatar Apr 28 '25 16:04 DasPoet