-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix Next by using default import for CJS #73
Conversation
Using named imports was rendering an error when using with Next.js and mdx-bundler, the following change fixes the problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense for the currently version range https://unpkg.com/mdast-util-mdx@0.1.0/index.js
An alternative could be updating
Line 49 in 30033e6
"mdast-util-mdx": "^0.1.0", |
^1.0.0
which is pure ESM and has no default export https://github.com/syntax-tree/mdast-util-mdx/blob/b27dc8aa3ff340815b5f04f15ee1e6ed3a753a79/index.js#L13-L23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is an error in Next + webpack et al, which you could perhaps report there. While CJS handling is non-standard, I believe users are right to expect Next/webpack to work the same as Node for CJS in ESM.
- I’m not sure whether the next version of
mdast-util-mdx
already works, it might expect a couple of updates in micromark/mdast/remark/unified, so we should probably wait a little bit before remark is updated pkg
is a bit of a vague name, and the code style doesn’t match this project: here’s what I suggest, but you can also check these things locally by runningnpm test
Co-authored-by: Titus <tituswormer@gmail.com>
Released in 1.12.2! https://github.com/wooorm/xdm/releases/tag/1.12.2 |
Update xdm to patch the default import error, as explained in the following (PR)[wooorm/xdm#73]
Update xdm to patch the default import error, as explained in the following (PR)[wooorm/xdm#73]
Update xdm to patch the default import error, as explained in the following (PR)[wooorm/xdm#73]
Using named imports was rendering an error when using with Next.js and mdx-bundler, the following change fixes the problem