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 2 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
27 changes: 26 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,23 @@ etc.) you use.
To use more modern JavaScript features than what your users support,
[configure esbuild’s `target`][esbuild-target].

`@mdx-js/esbuild` can also be used with [Bun][]:

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

```toml path="bunfig.toml"
preload = ["./bunMdxEsbuild.ts"]
```

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

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

karlhorky marked this conversation as resolved.
Show resolved Hide resolved
#### Rollup

<details>
Expand Down Expand Up @@ -798,6 +815,12 @@ 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].
See [the section above][bundler-esbuild] on how to configure it.
karlhorky marked this conversation as resolved.
Show resolved Hide resolved

## Further reading

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

[build-system-vite]: #vite

[bun]: https://bun.sh/
karlhorky marked this conversation as resolved.
Show resolved Hide resolved

[bundler-esbuild]: #esbuild

[bundler-rollup]: #rollup
Expand Down