HMR in Prod build?

Is it feasible to enable HMR in a production build?

I know that currently HMR is gated on __DEV__ but on a cursory look it seems that it would take very little change to enable it in prod (basically have the renderer call registerHMR and unregisterHMR). So my question is whether there are some dependencies that are not immediately obvious.

The motivation is that I have a dashboard implemented in Vue and users can write new widgets (visualizations) live in the dashboard. They are Vue components that get dynamically loaded. When users edit their widget it gets hot-updated. I can make it happen without the HMR API but using the API would make it more powerful and more seamless. (There is no Vite or vue-cli anywhere in sight.)

HMR is designed and intended for development. Production files are built and bundled (essentially becoming “static”) so I’m not sure how HMR would actually play into this - unless you’re suggesting running your site in dev mode and constantly in watch mode?

I’d be more inclined to provide them with a code editor and preview (such as https://sandpack.codesandbox.io/) and just commit the final result to whatever persistent storage you’re using.

Oh, I have monaco as editor and I just feed the SFC code through the sfc_compiler and import it from a blob via es-module-shims. That’s all easy and done. My question is just about replacing the live component then. There’s no filesystem involved, thus no watch. The fact that the core system and Vue are bundled is also a total non-issue.

All I need is to be able to call createRecord/rerender/reload in the HMR API. I had hoped someone who knows this stuff could tell me whether it’s easy to enable those calls or whether there are deep dependencies…