Skip to content
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

MDX file with draft prevents successful build #5658

Closed
1 task
LoyalPotato opened this issue Dec 21, 2022 · 4 comments
Closed
1 task

MDX file with draft prevents successful build #5658

LoyalPotato opened this issue Dec 21, 2022 · 4 comments
Assignees

Comments

@LoyalPotato
Copy link

What version of astro are you using?

1.6.9

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

The docs mention that we can use draft: true in both .md and .mdx files
I have a page with an empty mdx file with this:

---
draft: true
---

When I go to build the project I get the following error:

[astro:jsx] Transform failed with 1 error:
/Users/foo/Documents/Personal/loyalpotato.dev/src/pages/posts/empty.mdx:2:5: ERROR: Expected ";" but found ":"
file: /Users/foo/Documents/Personal/loyalpotato.dev/src/pages/posts/empty.mdx
 error   Expected ";" but found ":"
  File:
    /Users/foo/Documents/Personal/loyalpotato.dev/src/pages/posts/empty.mdx:2:5
  Code:
      1 | ---
    > 2 | draft: true
        |     ^
      3 | ---
    
  Stacktrace:
Error: Transform failed with 1 error:
/Users/foo/Documents/Personal/loyalpotato.dev/src/pages/posts/empty.mdx:2:5: ERROR: Expected ";" but found ":"
    at failureErrorWithLog (/Users/foo/Documents/Personal/loyalpotato.dev/node_modules/esbuild/lib/main.js:1624:15)
    at /Users/foo/Documents/Personal/loyalpotato.dev/node_modules/esbuild/lib/main.js:1413:29
    at /Users/foo/Documents/Personal/loyalpotato.dev/node_modules/esbuild/lib/main.js:678:9
    at handleIncomingPacket (/Users/foo/Documents/Personal/loyalpotato.dev/node_modules/esbuild/lib/main.js:775:9)
    at Socket.readFromStdout (/Users/foo/Documents/Personal/loyalpotato.dev/node_modules/esbuild/lib/main.js:644:7)
    at Socket.emit (node:events:520:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)

Link to Minimal Reproducible Example

https://codesandbox.io/s/silly-shannon-iuzder?file=/src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.
@bholmesdev
Copy link
Contributor

Hey @LoyalPotato! Looks like you need to install the MDX integration first:

npx astro add mdx

Let me know if this fixes your issue!

@bholmesdev bholmesdev self-assigned this Dec 21, 2022
@LoyalPotato
Copy link
Author

@bholmesdev The sandbox that I linked already has the integration as a dependency and it's still throwing the same error. Is it not showing for you?

@LoyalPotato
Copy link
Author

Ok, it was just missing the mdx() in the config. Sorry about that.

@tordans
Copy link
Contributor

tordans commented Dec 26, 2022

Thanks for documenting and solving this. I ran into the same problem. I opened withastro/roadmap#420 to suggest to make the console output more helpful in this / such a situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants