-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[React template] bun dev
issues
#4508
Comments
This is because Adding a dummy |
@extrasalt, thank you I tried this before but this solution only restarts the Server. We also need to update the code in the browser. This can be solved using WebSockets. The main problem is how to update only the parts of the code that have changed without reloading the page. It looks like this cannot be solved without improving As an example, this is webpack-dev-server |
I am not sure I understand what you mean by update the code in the browser. With this when I change a line in App.jsx or any of the child-components, the dev.jsx re-runs.. rebuilding the frontend in the process and updating what's in the ./build directory. You only need to refresh the page in the browser. (If you want that to happen automatically, I was using |
Please read about HMR it doesn’t reload a page, it replaces changed modules without reloading. If you reload the page, the form data will be lost and requests to the API will start, which will take quite a long time. |
Here's how HMR should work: Example by Vite |
I don't think bun has these templates anymore so can't change documentation or make this specific case easier. However we do have something similar now: #14324 |
What version of Bun is running?
0.8.1
What platform is your computer?
Darwin 22.3.0 x86_64 i386
What steps can reproduce the bug?
bun create react
bun run dev
localhost:3000
browser pagesrc/App.tsx
What is the expected behavior?
In development mode, file changes are expected to refresh the page automatically.
What do you see instead?
The text does NOT change automatically even after refreshing the page. Only by restarting the server.
One more problem, as of now the following code is running in
dev.tsx
:Importantly! We cannot do
build
indev
mode, as real projects are large and the build will take a long time.Additional information
Is it possible to auto-reload the page?
Is it possible not to build in
dev
mode as in webpack-dev-server?The text was updated successfully, but these errors were encountered: