Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Are there any known performance issues with hot CSS reloading in Bun


Are there any known performance issues with hot CSS reloading in Bun


There are known performance issues with hot CSS reloading in Bun, primarily related to its current implementation and the state of its development. Here are the key points:

Performance Issues

1. Disabled Hot Reloading: As of Bun v0.1.5, the built-in support for hot module reloading (HMR) for CSS and React is disabled due to bugs and a lack of end-to-end test coverage. This means that while the functionality exists, it may not work reliably in practice[4][6].

2. Bugs in HMR Implementation: The main bug affecting HMR is related to the websocket handler that manages reloading. This has led to situations where changes do not reflect in the browser without a manual server restart, which can disrupt the development workflow[4][7].

3. Need for Workarounds: Developers have had to implement workarounds, such as using external tools like `watchman` to monitor file changes and trigger a full page reload manually when updates occur. This adds complexity and can negate some of the performance benefits that Bun aims to provide[4][7].

4. Limited Testing: The HMR feature lacks comprehensive testing, which means that while it may work under certain conditions, it is not guaranteed to perform well across all use cases. This can lead to unpredictable behavior during development[4][6].

5. Performance Overhead: Anecdotal evidence suggests that switching between different versions of hot reloading frameworks can introduce performance overhead, which could be a concern when using Bun's current hot reloading setup[3].

In summary, while Bun does support hot CSS reloading, its current implementation has performance issues that can hinder development efficiency. Users may need to rely on workarounds until these issues are resolved in future updates.

Citations:
[1] https://github.com/softwarearchitect817/Bun-fast-JavaScript-runtime
[2] https://linkb.hashnode.dev/bunsh-with-react-typescript-tailwindcss-and-storybook
[3] https://github.com/facebook/create-react-app/issues/93
[4] https://github.com/oven-sh/bun/issues/833
[5] https://codeclubanalysis.hashnode.dev/bun-your-all-in-one-solution-for-high-performance-javascript
[6] https://bun.sh/docs/runtime/hot
[7] https://stackoverflow.com/questions/76427355/how-to-enable-hot-reloading-with-bun-in-a-react-application
[8] https://github.com/oven-sh/bun/discussions/7119