Open cliid opened 2 years ago
Thanks for reporting this issue @cliid. I've been facing the same problem multiple times myself. While mdx-bundler
wasn't the root of my issues, the "cryptic error messages" (as seen above) made it quite hard to track down the underlying issue.
(Seems like this also appeared in other reported issues.)
+1
mdx-bundler
version: 6.0.2node
version: v14.18.1npm
version: 6.14.15yarn
version: 1.22.15Relevant code or config
What you did:
I'm using
contentlayer
. I simply added thedashes
function above, and added it to the plugins list forremark-textr
. And then I rannpx contentlayer build
. It internally ranmdx-bundler
.What happened:
Reproduction repository: https://github.com/cliid/cliid.dev
Problem description:
contentlayer
threw the error above. I think the error comes frommdx-bundler
. However, the error message was not helpful at all. It just said "unexpected error."Suggested solution:
I think the error is caused because when the
dashes
function works, it replaces the frontmatter. Because no frontmatter is provided, it throws the error. To solve the problem, not using thedashes
function or only handling non-frontmatter text would be sufficient. However, the core issue here is thatmdx-bundler
is not providing a helpful error message. If possible, it'd be great ifmdx-bundler
outputted a better error message.