-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ParseError: Unexpected end of input #6923
Comments
Almost certainly related to Svelte's use of regexes for finding things like the |
That SvelteKit issue was specifically about using an HTML parser on SSR'd output (which actually is HTML and not Svelte component source) for the purposes of crawling an app for static rendering, and I don't think it's really related to this issue. I don't think we want to be trying to parse Svelte components with an HTML parser. This issue does seem related to the one addressed in #3894 but I haven't poked around at what the difference in the two situations is. |
May be fixed by #6611, but I believe we may need to break up that PR before the feature/fix gets in. |
Svelte uses HTML comment syntax for tags. And the parser fails for the given regex. There should be a fix on the regex level or change the comment style to JS syntax comments for svelte components. |
I have a similar error which is likely caused by same root cause. As this example isn't triggered by a comment I think it's worth to mention here: <script lang="ts">
import CodeMirror from './CodeMirror.svelte';
const code = `<style>\n \n</style>`;
</script>
<CodeMirror {code} />
A work-around is to trick the compiler a bit: <script lang="ts">
import CodeMirror from './CodeMirror.svelte';
// Svelte seems to break if style tag is written in string literal directly
const code = '<' + `style>\n \n</style>`;
</script>
<CodeMirror {code} /> |
Describe the bug
Compilation error
ParseError: Unexpected end of input
happens when you have a Svelte component with the following contents:The issue here is the commented line
<!-- style lang="scss"> -->
. If this line is removed compilation error is gone.I often comment out parts of markup when working and continously run into this issue.
Reproduction
<script lang="ts"> import '../app.css'; </script> <style> :global(body) { padding: 1rem; } </style>Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: