Closed boswellgao closed 3 years ago
Could you share more about your setup? Your Vite configuration, project structure, or ideally steps to reproduce the error.
@silvenon Thank you for your reply
here you can get the project
The problem is with TypeScript, not vite-plugin-mdx
. Vite only compiles away TypeScript, it doesn't do any type checking. One way to solve your problem is to add a common type definition for all your *.mdx
files by creating a file named e.g. src/mdx.d.ts
(the name doesn't matter):
declare module '*.mdx' {
let MDXComponent: (props: Record<string, unknown>) => JSX.Element
export default MDXComponent
}
If you need to be more specific about a particular *.mdx
, add a .d.ts
file with the same name.
@silvenon Thanks. you are right,it's typescript proplem TypeScript support for .mdx file extensions
in index.tsx
and the lint told me