You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some svelte packages, such as mode-watcher, leverages <svelte:head> to insert for example a flash of unstyled content (FOUC) prevention snippet, something along the lines of:
The reason I believe that this is how it should work is because of how write_server.js is written.
There, we can see that first the head is replaced, then the nonce(s) are replaced. To further investigate this, I tried to modify the write_server.js code that is shipped in node_modules (not the source code linked above mind you):
Describe the bug
Background
Some svelte packages, such as mode-watcher, leverages
<svelte:head>
to insert for example a flash of unstyled content (FOUC) prevention snippet, something along the lines of:That seems to work well for preventing FOUC - however the
%sveltekit.nonce%
is not replaced!I noticed this when investigating svecosystem/mode-watcher#47 (comment)
Current behaviour
results in something like:
Expected behaviour
should result in something like:
Additional notes
The reason I believe that this is how it should work is because of how write_server.js is written.
There, we can see that first the head is replaced, then the nonce(s) are replaced. To further investigate this, I tried to modify the
write_server.js
code that is shipped innode_modules
(not the source code linked above mind you):from:
to:
In other words, I tried to log some stuff in the app templates section.
There, as indicated by the comments:
works and correctly replaces the nonce but:
does not work. I am not sure why! Does it have something to do with the
s(template)
function? 🤔Reproduction
https://stackblitz.com/github/svecosystem/mode-watcher-reproduction
open developer tools, notice how
%sveltekit.nonce%
is present and not replacedSystem Info
Severity
serious, but I can work around it
The text was updated successfully, but these errors were encountered: