rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Feature]: Additional hooks for `HotModuleReplacementPlugin`

Open niksy opened this issue 8 months ago • 5 comments

What problem does this feature solve?

Currently there are some weird open issues regarding using Vue and HMR:

  • https://github.com/web-infra-dev/rsbuild/issues/3217
  • https://github.com/web-infra-dev/rsbuild/issues/4467

vue-loader seems like it’s in a low priority maintenance mode and there aren’t any signals or activity from core maintainers on long standing issues. Everything seems focused on Vite support and it’s a shame that crucial element for Vue usage in Rspack/Rsbuild is left to unmaintained dependancy.

If Rspack and Rsbuild can use Vite implementation as opposed to unmaintained vue-loader implementation, a lot of the weird issues and bugs could be fixed. If Unplugin version is used, only HMR support is current blocker AFAIK.

If this component can be switched to unplugin-vue, I think Rspack/Rsbuild could benefit from that, and this will also affect other parts such as Nuxt, greater adoption rate, etc.

@9aoy mentioned that for Unplugin/Vite version to be used as default there would need to be some hooks inside HMR plugin so it can reuse that implementation.

What does the proposed API of configuration look like?

Something that works similar to handleHotUpdate in Vite. This could also increase adoption of other Vite or Unplugin specific plugins which have HMR support integrated.

niksy avatar Feb 20 '25 09:02 niksy