mdx-bundler icon indicating copy to clipboard operation
mdx-bundler copied to clipboard

Importing Components that import other Components

Open dominik-sfl opened this issue 1 year ago • 2 comments

  • mdx-bundler version: 9.2.1
  • node version: 16.19.0
  • npm version: 8.19.3

What you did:

I am importing a component into my mdx blog post:

import Imper from "./Imper";

Hello!

<Imper />

When Imper does not rely on any other components from my own project, this works. However, when I import other components inside Imper (that are not provided as globals), I get this error:

Server Error
SyntaxError: Unexpected token '<'

This error happened while generating the page. Any console logs will be displayed in the terminal window.

I am not sure whether this is intended or what I am doing wrong here exactly? I would've expected mdx-bundler to automatically import all other components that my Imper component relies on?

I do know that providing those components as globals fixes this problem, but I do not want to have a ton of globals that I might not re-use a lot.

dominik-sfl avatar Apr 30 '23 09:04 dominik-sfl

Did you solve it?

xiaojundebug avatar Nov 03 '23 09:11 xiaojundebug

Adding my +1 here, I'm facing the same issue.

yswrepos avatar Apr 23 '24 15:04 yswrepos