Skip to content

Commit 993aa1a

Browse files
committed
Fix: Added react/jsv-dev-runtime to fakeRequire in compileMDX. Before the compileMDX function was only handing 'react/jsx-runtime' imports but in dev mode Next.js use 'react/jsx-dev-runtime' which exports jsxDEV. This was causing a 'jsxDEV is not a function' error when running yarn dev. This fix adds handling for 'react/jsx-dev-runtime' to the fakeRequire
function, resolving the development mode compilation error.
1 parent 2da4f7f commit 993aa1a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/utils/compileMDX.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export default async function compileMDX(
106106
const fakeRequire = (name: string) => {
107107
if (name === 'react/jsx-runtime') {
108108
return require('react/jsx-runtime');
109+
} else if (name === 'react/jsx-dev-runtime') {
110+
return require('react/jsx-dev-runtime');
109111
} else {
110112
// For each fake MDX import, give back the string component name.
111113
// It will get serialized later.

0 commit comments

Comments
 (0)