Closed qwertasyx closed 3 years ago
@qwertasyx you're probably missing something. Snowpacks HMR in electron should work just like in the browser. You can open the localhost URL and debug it in the browser. The basic examples this project provides seem to be working.
Thanks for your quick response :). I tried with the svelte and the hello world example.
Somehow import.meta.hot is undefined. As far as i understand snowpack (just getting started) this gets ommited when bundling for production. The NODE_ENV is set to 'development' so that should be ok.
Maybe you have an idea where i can look into a bit more to figure that out.
after setting devOptions: { hmr: true }
it works like expected.
In snowpack dev() its set implicit so i´m not sure where it gets lost along the way :D
Thanks for the clarification, it seems that the Snowpack's CLI and JavaScript API works a bit differently. Seems like an easy fix.
@qwertasyx could you provide an example of how the hmr
becomes undefined? I checked the example and the hrm is present, unless I explicitly define hmr
to false
. I though there might be an issue with deep merging of the snowpack config if you'd change any other devOptions
field, but it doesn't seem to be the case.
@karolis-sh I just put a console.log before the import.meta.hot
in the index.js
. But i didn´t really figure out why it was undefined. I will take another look in the coming days, maybe i will find smt that helps.
I assume since no one else brought this up its probably related to my setup specifically somehow, so i tried the plane examples on a W10 machine and an ubuntu system, with the same result. I just cloned the repo and did 'npm i' in the according example. Did i forget something obvious? (node14.15.0)
Ah, I can reproduce with your described steps on a mac also. By installing from the root of the project with yarn
, or in another separate project the import.meta.hot
seems defined. Yeah, this is a weird one.
I was expecting that as soon as i change something the view should update. in the Iogs can see that snowpack is doing its thing as expected, but i have to manually reload (Ctrl+r) to see the changes.
Am i missing something essential or misinterpreted how it should behave?