Failure to compile when string or comment includes `</script>`
kristopherbullinger opened this issue · 2 comments
Any comment or string that includes </script> will cause a failure to compile.
An example comment:
//hello 123 </script>
Example string:
let foo = "hello123 </script>";
This can be worked around in a comment by simply not using that exact sequence, and in a string by escaping the slash <\/script>, but is rather confusing because the error message will likely point at some other "incomplete" bit of code, such as an un-terminated string. Not to mention that a string or comment with such a sequence is valid javascript.
A minimal reproducible example in the svelte repl:
https://svelte.dev/repl/6a58379b1397450481499217ea7c3d9c?version=3.37.0
This is a duplicate of sveltejs/svelte#3039 / sveltejs/svelte#3840 / sveltejs/svelte#4406 / sveltejs/svelte#4996 / sveltejs/svelte#5024 / sveltejs/svelte#5237 / #133 / sveltejs/svelte#5810 / maybe others, and is not a bug. This is how parsing inline script tags works in HTML.
Apologies for posting a dupe -- thanks for the quick response!