Skip to content

Commit 4a1415d

Browse files
committedDec 8, 2022
Add note about use with vite-plugin-react
Related-to: vitejs/vite-plugin-react#38.
1 parent 1c83612 commit 4a1415d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎docs/docs/getting-started.server.mdx

+16
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,22 @@ If you use more modern JavaScript features than what your users support,
358358
Make sure `rollup@3` is not installed.
359359
</Note>
360360

361+
<Note type="info">
362+
**Note**: If you also use `vitejs/vite-plugin-react`, you need to force
363+
`@mdx-js/rollup` to run in the `pre` phase before it:
364+
365+
```js path="vite.config.js"
366+
//
367+
export default defineConfig({
368+
plugins: [
369+
{enforce: 'pre', ...mdx(/* jsxImportSource: …, otherOptions… */)},
370+
react()
371+
]
372+
})
373+
//
374+
```
375+
</Note>
376+
361377
See also [¶ Rollup][rollup], which is used in Vite, and see [¶ Vue][vue], if
362378
you’re using that, for more info.
363379

1 commit comments

Comments
 (1)

vercel[bot] commented on Dec 8, 2022

@vercel[bot]

Successfully deployed to the following URLs:

mdx – ./

mdx-mdx.vercel.app
v2.mdxjs.com
mdx-git-main-mdx.vercel.app
mdxjs.com

Please sign in to comment.