create-snowpack-app icon indicating copy to clipboard operation
create-snowpack-app copied to clipboard

Svelte hmr doesn't pick the style changes

Open germanftorres opened this issue 4 years ago • 2 comments

Hi, I'm still trying to understand how hmr works in snowpack.

Using the default template 0.8.0. When I change the css part of App.js, the hmr module reloads only the js part of the component. I see following resources loaded in the network tab.

_dist_/index.js?mtime=159....
_dist_/App.js?mtime=159

But as the change is in the css part, and svelte regenerates the scoped css, the css part of the component App.css.proxy.js should be loaded as well .

Thanks so much for all the great features in snowpack.

germanftorres avatar May 25 '20 11:05 germanftorres

That's an interesting problem! I've got a partial fix so that style changes are updated as expected, but there's still a problem in the compiler around where css isn't removed on destroy: https://github.com/sveltejs/svelte/issues/4901

It shouldn't block you, but it just means you may see some outdated CSS on the page until you do a full page reload until that issue is fixed.

FredKSchott avatar May 25 '20 18:05 FredKSchott

Same issue applies to Vue HMR (clean setup using @snowpack/app-template-vue). New styles are not applied until the cache gets busted in some way.

dlindenkreuz avatar Jun 01 '20 13:06 dlindenkreuz