-
Notifications
You must be signed in to change notification settings - Fork 648
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
unexpected token error #1796
Comments
here's an example file that produces the error when using 5.20.9 and later, but not 5.20.8:
|
@jwise7 this is a tricky one. There was some issues in the parser around how it handles expression continuations across new lines, lets take your example and show you the issues:
meta [
content="https://test.image.com/" +
encodeURIComponent("image.jpg").replace("'", "%27")
]
meta [
content="https://test.image.com/"+
encodeURIComponent("image.jpg").replace("'", "%27")
]
meta [
content="https://test.image.com/"+
encodeURIComponent("image.jpg").replace("'", "%27")
] In general the parser wasn't really designed to do these expression continuations across lines. However if the expression with newlines is enclosed in brackets it always works. eg: meta [
content=("https://test.image.com/"+
encodeURIComponent("image.jpg").replace("'", "%27"))
] or meta [
content=(
"https://test.image.com/" +
encodeURIComponent("image.jpg").replace("'", "%27")
)
] Although this change does break code like this, we decided it was more in the bug territory. It may be something we reconsider, but this is where we're at so far. |
the real issue may be with marko-prettier forcing one liners into multiple lines without the parens. and, removing the parens when i tried to add them. |
our marko-prettier approved work around looks like this: (it kept deleting the parens when I tried that method)
|
Marko Version: 5.20.9 and newer
Details
a production build command now fails with this error:
[marko-vite:pre] src\components\meta.marko(127,107): Unexpected token
125 | meta [
126 | itemprop="image"
Expected Behavior
this error isn't thrown in 5.20.8 or older compilers. guessing the new htmljs-parser codebase may have introduced this issue, but not sure.
Actual Behavior
the above error is thrown
Possible Fix
not sure, maybe it no longer allows string concatenation like in the example.
Your Environment
Steps to Reproduce
Stack Trace
closest thing to stack trace is in the top level description
The text was updated successfully, but these errors were encountered: