-
I've been attempting to implement MDX2 on a React project built on top of Vite but keep running into the same issue. I've seen #1870 with the same problem, but that issue is about CRA and I cannot find a good answer there that is applicable to Vite. For a repository that has this issue with only the necessary elements: https://github.com/Studio384/mindoc. I'm receiving the following error:
This is my import mdx from '@mdx-js/rollup';
import ViteYaml from '@modyfi/vite-plugin-yaml';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), ViteYaml(), mdx()],
assetsInclude: ['**/*.md', '**/*.mdx'],
optimizeDeps: {
include: ["react/jsx-runtime"],
},
}); This is where the MDX file is loaded: import { Container } from '@sippy-platform/mellow-ui';
import { MDXProvider } from '@mdx-js/react';
import Content from '../docs/en/start/log-in.mdx';
export default function Page() {
return (
<Container className="py-3">
<MDXProvider>
<Content />
</MDXProvider>
</Container>
);
} I'm using the latest version of all relevant packages: {
...
"type": "module",
"scripts": {
...
},
"dependencies": {
"@mdx-js/mdx": "^2.1.3",
"@mdx-js/react": "^2.1.3",
"@mdx-js/rollup": "^2.1.3",
...
"react": "18.2.0",
"react-dom": "18.2.0",
...
},
"devDependencies": {
...
"@types/react": "18.0.17",
"@types/react-dom": "18.0.6",
"@vitejs/plugin-react": "2.0.1",
...
"typescript": "4.7.4",
"vite": "3.0.9"
}
} I hope someone can help me out with the problem. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
uhh that's not mdx 2 in your deps? |
Beta Was this translation helpful? Give feedback.
uhh that's not mdx 2 in your deps?