-
-
Notifications
You must be signed in to change notification settings - Fork 432
[webpack] styles not loaded for async component #79
Comments
I experience the same issue. This only happens in production mode as @nolanlawson describes. For what it's worth, I notice |
Has anyone found a workaround besides disabling |
On second thought, this may be an issue with sapper-template, as I'm not even sure if So maybe the fix is just to remove |
As mentioned over on sveltejs/sapper-template#31 (comment), I've been having some issues getting this stuff to behave correctly. For now, the template is configured not to extract CSS at all — the CSS is just inlined with the JavaScript. Obviously that's frowned upon so I'll leave this issue open to remind us to figure out a robust fix (with sourcemap support, ideally!) but for now at least async styles should work in both dev and prod modes, because Svelte is handling it directly. |
Any further thoughts on this? Having components responsible for importing CSS via <:Head> means if you have more than one instance of a component on a page it duplicates the and you have to manually copy the external styles into the assets folder. |
I have async working fine in pinafore.social using mini-css-extract-plugin, albeit with a fork of Sapper so I'm not sure if it works in latest Sapper. My feeling is that ExtractTextPlugin should be removed from sapper-template because mini-css-exact-plugin is more performant (no double parse), more secure (allows use of CSS CSP), and makes more sense (it loads CSS as... CSS). |
I've written a minimal repro on top of the sapper-template to demonstrate. Also here's a video demonstration.
Steps to reproduce
Expected: the header should be red.
Actual: the header is not red.
Interestingly if you refresh, then the header does become red. So apparently the server-rendered version includes the style correctly.
The presence or absence of a sibling page seems to affect this. If you delete
routes/settings/more-settings.html
then the bug goes away.Repros in Chrome and Firefox using macOS. Sapper v0.3.2.
The text was updated successfully, but these errors were encountered: