Environment
- vinext: 0.0.34
- @vitejs/plugin-rsc: 0.5.21
- @mdx-js/rollup: (installed, auto-detected by vinext)
Problem
When using import.meta.glob to dynamically load MDX files in an RSC page,
the rsc:scan-strip plugin attempts to parse .mdx files as JavaScript
before @mdx-js/rollup has a chance to transform them. This causes a parse error.
Error
[plugin rsc:scan-strip] src/content/posts/2025/08/20/second-post/index.mdx
Error: Parse error @:1:1
The MDX files contain standard frontmatter (YAML between ---) and JSX syntax
(e.g. <span className='text-red-500'>), which are valid MDX but invalid JavaScript.
Root cause
rsc:scan-strip runs before @mdx-js/rollup in the plugin pipeline,
so it sees raw MDX instead of the transformed JS output.
Reproduction
- Create an App Router project with MDX content files containing frontmatter
- Use
import.meta.glob('/src/content/posts/**/*.mdx') in a lib file
- Run
vite build
Expected behavior
@mdx-js/rollup should transform MDX files to JS before rsc:scan-strip processes them,
or rsc:scan-strip should skip non-JS files that will be handled by other plugins.
Workaround
None found without changing the content file structure.