#MDX Error: Expected ";" but found ":"

22 messages · Page 1 of 1 (latest)

north yoke
#

When changing the file extension from md to mdx, I get the error Expected ";" but found ":". There's no stack trace and it points to the character before the : in the frontmatter.

#

It works and conforms to the schema with the .md extension

#
---
title: Title
byline: Author
date: 2023-02-21
updated: 2023-02-22
cover: /image.png
---
outer carbon
#

Is that the full file contents?

north yoke
#

No, but the rest doesn't seem to matter

#

Here's a file that has the same error:

#
---
title: Hello, world
byline: Jerome
date: 2023-02-25
cover: assets/cover.png
---

This is the contents
#

It only shows this error once the schema is met, otherwise it shows a schema error

#

(So something must be able to parse the frontmatter)

outer carbon
#

Which version of the MDX integration do you have installed?

north yoke
#

it wasn't installed

#

i got my sites mixed up

outer carbon
#

😅 haha, glad we’ve solved it

#

Wonder if we can give a hint in this case. Expected ";" but found ":" isn’t very helpful 🤔

charred ice
#

We're supposed to have one actually

charred ice
outer carbon
#

Huh. @north yoke any chance you're using Astro v1? Looks like we should be showing a more helpful message since v2 so would be good to know if that's not working.

#

Oh although I guess that's unlikely given I see the pretty error overlay

charred ice
#

I think it doesn't trigger because the error message doesn't have "SyntaxError" in it

outer carbon
#

Ahh. Is there a way we check earlier? Feels like we could interrupt any .mdx loading without checking for a specific error message. (I did look yesterday briefly but don't know the codebase well enough to really know where to look.)

charred ice
#

I think we avoided this route in case someone wanted to have their own MDX integration