{"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,"search_vec":"'/mdx':30,44,54,78 '2022':71 '3.4.0':34 'automat':15 'babel':56 'browser':58 'built':61 'built-in':60 'bundl':59 'cadenc':66 'compil':7 'current':31 'deprec':5 'differenti':49 'esbuild':18 'esm':9 'esm-on':8 'function':36 'instead':79 'javascript':80 'js':29,43,53,77 'jsx':16,84 'key':48 'last':69 'maintain':73 'map':14,64 'markdown':83 'mdx':6,28,42,52,76,82 'mdx-js':27,41,51,75 'migrat':47 'plugin':21 'port':39 'releas':65,70 'rewrit':25 'rollup':20 'runtim':12,17 'smaller':57 'sourc':13,63 'sporad':68 'stabl':32 'typescript':85 'use':74 'user':45 'version':33 'vs':50 'xdm':1,2,81","created_at":"2026-05-01T13:51:09.249586+00:00","updated_at":"2026-05-01T13:51:09.249586+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/wooorm/xdm","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/xdm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}