Update snowpack and @snowpack/plugin-svelte to latest versions and the hot reload fires before compiled file is written to disk. #3789
Unanswered
jeberly
asked this question in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We recently upgraded svelte to
3.44.0
& @snowpack/plugin-svelte to3.7.0
.We are currently loading our app via our
go
app so we are usingsnowpack build --clean --watch --hmr --no-minify --no-bundle
to watch and build. We also specifywindow.HMR_WEBSOCKET_URL = 'ws://localhost:12321';
in our js file to avoid snowpack inserting the HMR_WEBSOCKET_PORT inline script.After upgrading, when we make a change to a component, watch picks up the change and the
ws
connection emits{type: 'update', url: '/_dist_/components/Left.svelte.js', bubbled: false}
and we can visibly see the Left component is reloaded but the markup is not the new markup until we do a manual reload or make a 2nd change, the 1st change is available.We manually edited the source code for
hmr-client.js
in_snowpack/pkg
inserted a "sleep" via setTimeout after receiving update event and about 100ms seemed to make it "work" in that we see our most recent update. We also removed sleep and put in a full page reload() instead of HMR reload and the file still contained previous change on full page reload.It seems the reload is firing before the svelte compile has completed for the file that was changed.
Any ideas? Happy to provide more info or any debugging help I can.
Thanks again for your work on Snowpack/HMR!
Beta Was this translation helpful? Give feedback.
All reactions