Skip to content

[Bug]: Hot reloading breaks for lazily loaded components if a file contains more than one export #3428

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

Open
MIreland opened this issue Sep 10, 2024 · 5 comments
Assignees

Comments

@MIreland
Copy link

Version

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 183.77 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 128.0.6613.120
    Safari: 17.6
  npmPackages:
    @rsbuild/core: 1.0.1-rc.5 => 1.0.1-rc.5 
    @rsbuild/plugin-react: 1.0.1-rc.5 => 1.0.1-rc.5

Details

RSBuild's lazily loaded children lose the ability to hot reload when additional exports exist in a file that is lazily loaded.

I would expect this to work, or at a minimum a warning/error to be thrown.

Screen.Recording.2024-09-09.at.8.37.22.PM.mov

Reproduce link

https://github.com/MIreland/lazy-loading-rsbuild-bug

Reproduce Steps

  1. execute pnpm dev
  2. edit ParentExample.tsx or ChildExample.tsx and save the file- note that the page does not hot reload
  3. comment out line 6 in ParentExample.tsx (the export const THIS_BREAKS_THINGS).
  4. Reload the page.
  5. edit ParentExample.tsx or ChildExample.tsx - hot reloading works.
@MIreland MIreland added the bug Something isn't working label Sep 10, 2024
@SoonIter SoonIter self-assigned this Sep 10, 2024
@9aoy
Copy link
Contributor

9aoy commented Sep 10, 2024

React refresh not work is expected, see pmmmwh/react-refresh-webpack-plugin#249.
But there seems to be something wrong with Silently fails and no full refresh.

@SoonIter SoonIter removed their assignment Sep 10, 2024
@smithyj
Copy link

smithyj commented Mar 10, 2025

@SoonIter Do you know if the official team will push for this fix

@SoonIter
Copy link
Member

SoonIter commented Mar 10, 2025

@SoonIter Do you know if the official team will push for this fix

what official team? React-refresh team? This is an unfixable problem because of the flexibility of react component

https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload

If Rsbuild can not reload the page in this case, please report it as a new issue.

@9aoy could you please check if this issue is fixed?


the fully page reload has still not been triggered In 1.2.16... our fault

@chenjiahan cc

@smithyj
Copy link

smithyj commented Mar 14, 2025

@SoonIter Do you know if the official team will push for this fix

what official team? React-refresh team? This is an unfixable problem because of the flexibility of react component

https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload

If Rsbuild can not reload the page in this case, please report it as a new issue.

@9aoy could you please check if this issue is fixed?

the fully page reload has still not been triggered In 1.2.16... our fault

@chenjiahan cc

I’m used react lazy and react router v7 in rsbuild, but it not working on hot reload, and Rsbuild can not auto reload the page

@chenjiahan chenjiahan removed the bug Something isn't working label Apr 7, 2025
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

No branches or pull requests

5 participants