Skip to content

How to use @mdx-js/rollup with Vite? #1981

Answered by ChristianMurphy
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

This appears to be the same as #1973 ?


The issue is that, mdx is native ESM and your project is not native ESM.

From vite's documentation.

Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM via type: "module". In this case, the config file is auto pre-processed before load.

https://vitejs.dev/config/#config-file-resolving

Here pre-processing to CJS will cause an error.
Add "type": "module" to your package.json to ensure it is native ESM.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Lrunlin
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants