-
Notifications
You must be signed in to change notification settings - Fork 258
Open
Description
Environment
- vinext: 0.0.32
- vite: 8.0.1
- @vitejs/plugin-rsc: 0.5.21
- @cloudflare/vite-plugin: latest
- React: 19.2.x
Problem
In an App Router project with dynamic routes (e.g. [year]/[month]/[day]/[slug]/page.tsx),
MDX files cannot be loaded dynamically in the RSC build environment.
Attempt 1: Dynamic import with template literal
await import(`@/content/posts/${year}/${month}/${day}/${slug}/index.mdx`)Error at runtime:
No such module "@/content/posts/..."
Attempt 2: import.meta.glob
// src/lib/mdx-loader.ts
export const mdxModules = import.meta.glob('@/content/posts/**/*.mdx', { eager: true })Error at runtime:
TypeError: (intermediate value).glob is not a function
import.meta.glob is not being transformed by the RSC build pipeline (rolldown),
and reaches the Workers runtime as-is, causing a runtime error.
Expected behavior
import.meta.glob should be statically transformed at build time in the RSC environment,
as it is in standard Vite builds.
Workaround
None found. The nextra-docs-template example uses static imports only,
which is not viable for blog-style dynamic routing.
Notes
@mdx-js/rollupis configured correctly (auto-detected by vinext)- Static MDX imports (as in nextra-docs-template) work fine
- The issue is specific to the RSC build environment; the transformation
that Vite normally applies toimport.meta.globdoes not occur there
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels