esbuild-mdx is a plugin for esbuild that resolves .md and .mdx files into React components, enabling markdown-driven content in React apps. Current stable version is 0.2.0 (released 2021), with a low release cadence (3 releases). Key differentiators: integrates directly with esbuild's plugin system, supports options passing to MDX, and is lightweight compared to Webpack-based MDX bundlers. Alternative to @mdx-js/loader but for esbuild. Minimum peer dependencies: react, react-dom, and @mdx-js/react.
npm install esbuild-mdxNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up esbuild with esbuild-mdx plugin and import a .md file as a React component.
Update to 0.2.0 and pass options object to the function if needed, e.g., require('esbuild-mdx')({ remarkPlugins: [] })Use @mdx-js/react@^1.6.22 exactly. Do not upgrade to v2+.
Ensure you only use esbuild-mdx in a Node.js build script, not in client-side code.
Use const mdxPlugin = (await import('esbuild-mdx')).default() in an ESM context.Use require() or dynamic import with .default.
Run: npm install @mdx-js/react@^1.6.22
Correct: require('esbuild-mdx')()Run: npm install esbuild-mdx --save-dev
Ensure your esbuild entry points or resolve extensions include .md and .mdx, e.g., resolveExtensions: ['.js', '.md', '.mdx']
Call require('esbuild-mdx')() with no arguments or an options object: require('esbuild-mdx')({})