-
Notifications
You must be signed in to change notification settings - Fork 60
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
In page frontmatter, an env var condition followed by an import leaves an unterminated string #1009
Comments
Interesting 🤔 If you add a semicolon after the if statement it starts to work again |
Hm that doesn't work for me. Wonder if what you saw is this other unexpected behavior I noticed in the stackblitz but not in my app: if you fix the problem by for example commenting out the |
Seems like a compiler issue, you can paste the frontmatter code in https://live-astro-compiler.vercel.app to observe the invalid output. const $$stdin = $$createComponent(($$result, $$props, $$slots) => {
// good
// if (true) {}
// good
// console.log(import.meta.env.VITE_DEV)
// bad
if (import.meta.env.DEV) {}
/**
* necessary for bug
*
' // <----- the problem
return $$render``;
}, '<stdin>', undefined);
export default $$stdin; Editing the |
@olets Actually, I think I had removed the comment. There was still an error, but a different one. I think the "fix" was only coincidental |
Astro Info
My real local example:
Minimal reproduction:
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In page frontmatter, an env var condition followed by an import leaves an unterminated string, which breaks the rest of the page.
Checking the participation box because I'm willing, but it doesn't feel like my wheelhouse.
What's the expected result?
Env var use in frontmatter is not more restricted than the use of other values.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-nfmb4n?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: