Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bun section to Getting started #2517

Merged
merged 6 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ MDX is a language that’s compiled to JavaScript.
The easiest way to get started is to use an integration for your bundler if you
have one:

* if you use **esbuild**,
* if you use **esbuild** (or Bun),
install and configure [`@mdx-js/esbuild`][mdx-esbuild]
* if you use **Rollup** (or Vite),
install and configure [`@mdx-js/rollup`][mdx-rollup]
Expand Down Expand Up @@ -234,6 +234,10 @@ etc.) you use.
To use more modern JavaScript features than what your users support,
[configure esbuild’s `target`][esbuild-target].

See also [¶ Bun][javascript-engines-bun],
which you might be using,
for more info.

#### Rollup

<details>
Expand Down Expand Up @@ -798,6 +802,26 @@ MDX files can be imported in Node by using
[`@mdx-js/node-loader`][mdx-node-loader].
See its readme on how to configure it.

#### Bun

MDX files can be imported in [Bun][] by using
[`@mdx-js/esbuild`][mdx-esbuild].

<details>
<summary>Expand example</summary>

```toml path="bunfig.toml"
preload = ["./bun-mdx.ts"]
```

```js twoslash path="bun-mdx.ts"
import {plugin} from 'bun'
import mdx from '@mdx-js/esbuild'

plugin(mdx())
```
</details>

## Further reading

* If you want to use MDX content in your project,
Expand Down Expand Up @@ -911,6 +935,10 @@ See its readme on how to configure it.

[build-system-vite]: #vite

[bun]: https://bun.sh

[javascript-engines-bun]: #bun

[bundler-esbuild]: #esbuild

[bundler-rollup]: #rollup
Expand Down