Packages / @mdx-js/esbuild
@mdx-js/esbuild
esbuild plugin for MDX.
This package is an esbuild plugin to support MDX.
This integration is useful if you’re using esbuild (or another tool that uses esbuild).
If you want to evaluate MDX code then the lower-level compiler (@mdx-js/mdx
) can be used. to support nonstandard JSX runtime (such as Vue), @mdx-js/mdx
can also be used, or our webpack loader (@mdx-js/loader
) or Rollup plugin (@mdx-js/rollup
).
This package is ESM only. In Node.js (version 16+), install with npm:
npm install @mdx-js/esbuild
Do something like this with the esbuild API:
import mdx from '@mdx-js/esbuild'
import esbuild from 'esbuild'
await esbuild.build({
// Replace `index.js` with your entry point that imports MDX files:
entryPoints: ['index.js'],
format: 'esm',
outfile: 'output.js',
plugins: [mdx({/* jsxImportSource: …, otherOptions… */})]
})
This package exports no identifiers. The default export is mdx
.
mdx(options?)
Create an esbuild plugin to compile MDX to JS.
esbuild takes care of turning modern JavaScript features into syntax that works wherever you want it to. With other integrations you might need to use Babel for this, but with esbuild that’s not needed. See esbuild’s docs for more info.
options
(Options
, optional) — configurationESBuild plugin (Plugin
from esbuild
).
Options
Configuration (TypeScript type).
Options are the same as CompileOptions
from @mdx-js/mdx
.
This package is fully typed with TypeScript. It exports the additional type Options
. See § Types on our website for information.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of Node. This means we try to keep the current release line, @mdx-js/esbuild@^3
, compatible with Node.js 16.
See § Security on our website for information.
See § Contribute on our website for ways to get started. See § Support for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.