-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newline in child element text causes parse error in Svelte 5.17.4 #15004
Comments
Instead of posting screenshots of code and adding them as txt files here, you can create a REPL. This makes it super easy for everyone to reproduce your issue. |
Thanks for the tip and link regarding the repl. I've created one, and I'm not seeing the problem. https://svelte.dev/playground/0b65b04be8dc450288d2c592e239a31f?version=5.17.4 I suspect it's a Linux/Windows difference regarding end-of-lines. But I guess it could also be the versions of other packages. Is there a way in the repl to specify the exact version of rollup etc? |
I don't think so. For more complex repros I often see people using https://stackblitz.com/ For me it looks more like a tooling issue. There's something in your pipeline that does not properly process the file and writes it into a new place without properly encoding the newline, making it a verbatim newline. I doubt this is an issue with Svelte itself. Are you sure this happened solely because of a Svelte upgrade? |
Looking at the output again, this looks weird
So maybe you actually do have a control character in there? And the REPL prevents them. |
It definitely happened just by changing the svelte version from 5.17.3 to 5.17.4 and doing "npm install". I should note this is in a sveltekit application. I'll work on getting a trimmed down full project and try it with/without sveltekit. |
I think, I'm hitting the same kind of error. Please see the CI logs. It only occurs on the Windows runner (Linux and Mac are fine). Reverting Hopefully this provides some additional context. |
I can confirm, the issue does seem to be due to the esrap version. With svelte 5.17.4 the issue disappears if I force the use of esrap 1.3.2 and comes back if I force the use of esrap 1.4.2 via the "overrides" in the package.json.
|
It works with esrap 1.3.7. Fails in a different component in 1.4.0. Fails in the current way in 1.4.1. Could be related to this change in esrap 1.4.1? That has some replacement of "\n" being done. |
I came to the same conclusion and linked this issue with the esrap PR |
reopening until we've bumped the dependency version |
I think we need |
I'm having the same problem on svelte 5.17.4 when using prettier which formats the code to span multiple lines. I think the compiler should know to fix these text issues. Also I think it's better if strings in text nodes are properly evaluated to prevent any open door to XSS. |
This was a bug with |
Ah I see! I'll wait until the fix is released then. And my bad! I thought it could be some XSS issue, just trying to help out 😅 |
I've updated to svelte 5.18.0. I can confirm that this fixes the problem that I reported in 5.17.4. Thanks |
Describe the bug
Starting with Svelte 5.17.4, there is a parse error when the text passed as a child element contains a newline.
Occurring on Windows using VS Code in runes mode.
Reproduction
Attaching images and uploading with "txt" extension as uploading "svelte" files isn't supported.
CustomDiv.txt
CustomPanel.txt
package.json
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: