-
-
Notifications
You must be signed in to change notification settings - Fork 159
Next.js 13 + mdx-bundler error #307
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
check docs, added config: /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true, // Recommended for the `pages` directory, default in `app`.
experimental: {
// runtime: 'experimental-edge', // 'node.js' (default) | 'experimental-edge'
appDir: true,
esmExternals: 'loose',
serverComponentsExternalPackages: ['esbuild', '@mdx-js/esbuild', 'shiki', '@code-hike/mdx', 'mdx-bundler']
}
};
module.exports = nextConfig; then error:
|
or add
|
Example source: https://github.com/willin/beta.willin.wang/blob/main/ui/mdx-component.tsx#L5 can edit here: 'use client'; // add this line, optional
import { CH } from '@codehike/mdx/components'; // add this line
import { getMDXComponent } from 'mdx-bundler/client';
import { createElement, useMemo } from 'react';
import { AgeTimer } from './components/age-timer';
const mdxComponents = {
CH, // add this line
a: (props: any) =>
createElement('a', {
target: '_blank',
...props
}),
// img: ({ src, ...rest }) =>
// createElement('img', {
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// 'data-src': src,
// className: 'post-image lazyload',
// ...rest
// }),
AgeTimer: AgeTimer
}; |
PR #308 may fix this. If you can, try using the canary version from that PR and let me know if it fixes the problem |
I'm facing a similar issue with next 13 but the only difference is that I get the error only in production. I get a 500 server error whenever I try to access my website.
I've also tried this method as well but It didn't work. |
@staranbeer are you using |
@pomber I'm using getServerSideProps for this. |
If you can try using |
Oh, that might not be possible with the kind of app I'm working on. It need to fetch data on every request. here's the app readout . |
can you try the new canary version from #308 and share the error you are getting? |
should be fixed with |
The text was updated successfully, but these errors were encountered: