{"record":{"id":"80fd8bc34b30267c","repo":"mdx-js/mdx","slug":"expected-jsxdev-given-to-evaluate","errorCode":null,"errorMessage":"Expected `jsxDEV` given to `evaluate`","messagePattern":"Expected `jsxDEV` given to `evaluate`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mdx/lib/util/resolve-evaluate-options.js","lineNumber":72,"sourceCode":" *   Configuration.\n * @returns {{compiletime: CompileOptions, runtime: RunOptions}}\n *   Split options.\n */\nexport function resolveEvaluateOptions(options) {\n  const {\n    Fragment,\n    baseUrl,\n    development,\n    jsx,\n    jsxDEV,\n    jsxs,\n    useMDXComponents,\n    ...rest\n  } = options || {}\n\n  if (!Fragment) throw new Error('Expected `Fragment` given to `evaluate`')\n  if (development) {\n    if (!jsxDEV) throw new Error('Expected `jsxDEV` given to `evaluate`')\n  } else {\n    if (!jsx) throw new Error('Expected `jsx` given to `evaluate`')\n    if (!jsxs) throw new Error('Expected `jsxs` given to `evaluate`')\n  }\n\n  return {\n    compiletime: {\n      ...rest,\n      development,\n      outputFormat: 'function-body',\n      providerImportSource: useMDXComponents ? '#' : undefined\n    },\n    runtime: {Fragment, baseUrl, jsx, jsxDEV, jsxs, useMDXComponents}\n  }\n}\n","sourceCodeStart":54,"sourceCodeEnd":88,"githubUrl":"https://github.com/mdx-js/mdx/blob/685627a819567c0788eadb85f5f57065bcc81c2c/packages/mdx/lib/util/resolve-evaluate-options.js#L54-L88","documentation":"When the `development` option is true, resolveEvaluateOptions requires `jsxDEV`, the development-mode JSX factory that includes source-location and component-stack diagnostics. In development the compiled MDX code calls `jsxDEV(...)`, so a missing `jsxDEV` makes evaluation impossible and the check throws before running.","triggerScenarios":"Calling `evaluate(code, {...runtime, development: true})` without providing `jsxDEV` from 'react/jsx-dev-runtime' (or equivalent); sharing one runtime object between dev/prod builds where dev-only exports are absent.","commonSituations":"Toggling `development: true` in a dev environment while the runtime was built for production ('react/jsx-runtime' has no `jsxDEV`); bundlers resolving the production React build; copying a prod evaluate config into a dev code path.","solutions":["Import `jsxDEV` from 'react/jsx-dev-runtime' (or your library's dev runtime) and include it in the options when `development` is true.","Conditionally build the runtime: `development ? require('react/jsx-dev-runtime') : require('react/jsx-runtime')`.","Set `development: false` if you intentionally want the production path (then `jsx`/`jsxs` are required instead)."],"exampleFix":"// before\nawait evaluate(code, { Fragment, jsx, jsxs, development: true })\n// after\nimport { Fragment, jsxDEV } from 'react/jsx-dev-runtime'\nawait evaluate(code, { Fragment, jsxDEV, development: true })","handlingStrategy":"validation","validationCode":"if (development && !runtime.jsxDEV) {\n  throw new Error('development: true requires `jsxDEV` (import from react/jsx-dev-runtime)')\n}","typeGuard":"function hasDevRuntime(rt) {\n  return typeof rt === 'object' && rt !== null && typeof rt.jsxDEV === 'function'\n}","tryCatchPattern":"try {\n  const result = await evaluate(code, { ...runtime, development: true })\n} catch (err) {\n  if (err.message === 'Expected `jsxDEV` given to `evaluate`') {\n    console.error('Use react/jsx-dev-runtime exports when development is true')\n  } else throw err\n}","preventionTips":["Pick the runtime module conditionally: 'react/jsx-dev-runtime' when development is true, otherwise 'react/jsx-runtime'.","Tie `development` in MDX options to the same env flag used to select the runtime module.","Test both dev and prod evaluate paths in CI."],"tags":["mdx","evaluate","development-mode"],"backgroundTag":"missing-required-option","analyzedSha":"685627a819567c0788eadb85f5f57065bcc81c2c","analyzedAt":"2026-09-02T16:11:18.599Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}