A Babel plugin that enables hot module replacement (HMR) for Vue 3 JSX and TSX components when using build tools like webpack and Rspack. Version 1.0.0 is latest. It works alongside @vue/babel-plugin-jsx and requires babel-loader. The plugin injects HMR code for components that are exported and declared via defineComponent, supporting named exports, re-exports, and default exports. It does not work with Vite (use @vitejs/plugin-vue-jsx instead). Provides HMR detection similar to Vite's plugin but for webpack/Rspack ecosystems.
npm install babel-plugin-vue-jsx-hmrVerified import paths — ran on the pinned version, not inferred.
Webpack configuration enabling HMR for Vue 3 JSX components, with a sample component using defineComponent.
Ensure each component is a root-level statement: export const Foo = defineComponent({...}) or export default defineComponent({...}). Anonymous default exports work.Specify plugins in order: ['@vue/babel-plugin-jsx', 'babel-plugin-vue-jsx-hmr'].
If using Vite, remove babel-plugin-vue-jsx-hmr and add @vitejs/plugin-vue-jsx to vite.config.js.
Set devServer: { liveReload: false, hot: true } in webpack.config.js.Wrap component options with defineComponent: const Comp = defineComponent({...}).Install @vue/babel-plugin-jsx: npm install @vue/babel-plugin-jsx --save-dev
Ensure component is exported and declared with defineComponent, and plugins order is correct: ['@vue/babel-plugin-jsx', 'babel-plugin-vue-jsx-hmr'].
Set mode: 'development' in webpack config, or use NODE_ENV=development.
Add @vue/babel-plugin-jsx to Babel plugins before babel-plugin-vue-jsx-hmr.