Snowpack: devOptions.hmr

Created on 29 May 2020  路  9Comments  路  Source: snowpackjs/snowpack

Some environments won't be able to use HMR, so we should allow users to turn this on/off.

  • [x] PR 1: Add devOptions.hmr to config.ts, and then only add import.meta.hot code during dev.ts if it is set to true
  • [x] PR 2: Update our official Snowpack plugins to respect this value.

Either PR would make a great community contribution!

good first issue help wanted

All 9 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FredKSchott picture FredKSchott  路  6Comments

FredKSchott picture FredKSchott  路  6Comments

FredKSchott picture FredKSchott  路  6Comments

backspaces picture backspaces  路  5Comments

drwpow picture drwpow  路  3Comments