{"id":26665,"library":"xdm","title":"xdm","description":"xdm is a deprecated MDX compiler (ESM-only, no runtime, source maps, automatic JSX runtime, esbuild and Rollup plugins) that was a rewrite of @mdx-js/mdx. Current stable version 3.4.0. All functionality has been ported to mdx-js/mdx; users should migrate. Key differentiators vs @mdx-js/mdx: no Babel, smaller browser bundle, built-in source maps. Release cadence was sporadic (last release 2022). Not maintained, use mdx-js/mdx instead.","status":"deprecated","version":"3.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/wooorm/xdm","tags":["javascript","xdm","mdx","markdown","jsx","typescript"],"install":[{"cmd":"npm install xdm","lang":"bash","label":"npm"},{"cmd":"yarn add xdm","lang":"bash","label":"yarn"},{"cmd":"pnpm add xdm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Official replacement; all features ported","package":"@mdx-js/mdx","optional":false}],"imports":[{"note":"ESM-only; require() throws Error. Use mdx-js/mdx instead.","wrong":"const { compile } = require('xdm')","symbol":"compile","correct":"import { compile } from 'xdm'"},{"note":"Added in v3.3.0. Runs compiled MDX in sandbox. Deprecated.","wrong":"","symbol":"run","correct":"import { run } from 'xdm'"},{"note":"Low-level processor factory. Used internally. Deprecated.","wrong":"","symbol":"createProcessor","correct":"import { createProcessor } from 'xdm'"}],"quickstart":{"code":"import { compile } from 'xdm'\nimport { readFile, writeFile } from 'node:fs/promises'\n\nconst mdx = await readFile('example.mdx', 'utf8')\nconst code = await compile(mdx, { jsx: true })\nawait writeFile('output.js', String(code))\n\nconsole.log('Compiled successfully')","lang":"typescript","description":"Compile an MDX file to JavaScript using the compile() function."},"warnings":[{"fix":"Migrate to mdx-js/mdx: https://mdxjs.com/","message":"xdm is deprecated. All features have been ported to mdx-js/mdx. Use mdx-js/mdx instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use import instead of require().","message":"ESM only: Node 12+ required, cannot require() the package.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"xdm compiles to plain JS, no runtime needed.","message":"xdm has no runtime: do NOT use `@mdx-js/react` or similar runtime helpers.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { compile } from 'xdm' instead of require.","cause":"Trying to require() an ESM-only package","error":"ERR_REQUIRE_ESM"},{"fix":"Run `npm install xdm`. However, consider using mdx-js/mdx instead.","cause":"Package not installed","error":"Error: Cannot find module 'xdm'"},{"fix":"Use `import { compile } from 'xdm'` (named export).","cause":"Incorrect import (e.g., default vs named)","error":"TypeError: compile is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}