Some environments won't be able to use HMR, so we should allow users to turn this on/off.
devOptions.hmr to config.ts, and then only add import.meta.hot code during dev.ts if it is set to true Either PR would make a great community contribution!
Does that mean that React Fast Refresh is currently not supported in Snowpack?
@weyert React Fast Refresh is supported, https://www.snowpack.dev/#hot-module-replacement
Fast Refresh is supported by adding this Snowpack plugin: @snowpack/plugin-react-refresh
Note that it is currently not included by default for CSA React templates due to its experimental status (when Create React App feels comfortable enough to turn it on by default, we will probably do the same)
I'd like to have a go at this issue 馃槃
Woo, that would be great! "PR 1" outlined above is a great place to start, just let me know how I can help
Hi @FredKSchott !
Awesome, thanks! 馃槃 I've just opened the first PR. This is my first one in this project, so I'm not fully aware of what should I add in the description... If there's anything missing let me know and I'll gladly add it!
Tackled PR2 in https://github.com/pikapkg/create-snowpack-app/commit/40fe4bb577c820faa027cd3050e28e5aa03b8257
Preact's Prefresh plugin is the only other plugin that i know of that automatically adds hmr.
/cc @JoviDeCroock FYI to add these few lines to your plugin as well when you have a second (see the commit linked above)
Thanks for jumping in to help @victorhmp !
You're welcome @FredKSchott ! :D