oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.12k stars 2.76k forks source link

Duplicate Output Issue After Repeated Saves with `bun --hot` #13511

Open sir-siren opened 2 months ago

sir-siren commented 2 months ago

What version of Bun is running?

1.1.26

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

  1. Start with a simple script file, script.js, containing:
    console.log("Hello");
  2. Run the script using Bun with the hot reload option:
    bun --hot script.js

    Output:

    Hello
  3. Without making any changes, save the file again (Ctrl+S).

What is the expected behavior?

Even after saving the file multiple times without making changes, the output should remain:

Hello

What do you see instead?

After saving the file a second time (or more) without making any changes, the output duplicates:

Hello
Hello

image

Additional information

No response

Jarred-Sumner commented 2 months ago

--hot mode always reloads every file right now. In the future that might change. But we haven’t been able to build that yet.

sir-siren commented 2 months ago

--hot mode always reloads every file right now. In the future that might change. But we haven’t been able to build that yet.

Hey there @Jarred-Sumner!

Thank you so much for the update! I completely understand that the --hot mode reloading every file is something that might change in the future, and I’m really excited to see how Bun continues to evolve. Even in its current state, Bun is such an incredible tool, and it’s been a huge help in my teaching. I teach JavaScript at an institution, and using bun --hot feature has really streamlined the process, allowing me and my students to focus more on coding without constantly switching between the editor and browser.

If it’s possible to prioritize tweaking the --hot mode to make it even smoother, that would be amazing. But even as it is now, I deeply appreciate all the hard work you’re putting into Bun. It’s making a real difference for so many developers out there. Thanks again for everything you’re doing, and I’m really looking forward to seeing what comes next!

Keep up the fantastic work! 🌟