react-router
react-router copied to clipboard
[Bug]: (v7) @mdx-js/rollup: Unexpected `FunctionDeclaration` in code: only import/exports are supported. Error for a custom vite server.
What version of React Router are you using?
v7
Steps to Reproduce
- Install react-router (7.0.0-pre.1)
- Install @mdx-js/rollup (tested with ^3.1.0 and ^3.0.1)
- Create a custom vite server and add plugins for mdx + react-router
- Run custom vite server
Demo: https://stackblitz.com/edit/vitejs-vite-xmllxz?file=package.json
Expected Behavior
As a user, I expect the same behaviour for a custom vite server as a react-router one when using a mdx plugin.
Actual Behavior
When I run a react-router via a custom vite server with @mdx-js/rollup plugin I got error:
[plugin:@mdx-js/rollup] Unexpected `FunctionDeclaration` in code: only import/exports are supported
/home/projects/vitejs-vite-xmllxz/Post.mdx:2:1
1 | import {jsxDEV as _jsxDEV} from "react/jsx-dev-runtime";
2 | function _createMdxContent(props) {
| ^
3 | const _components = {
4 | h1: "h1",
Demo: https://stackblitz.com/edit/vitejs-vite-xmllxz?file=package.json