mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #77] MDX auto-injection doesn't work - plugin runs after vite:import-analysis #22
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rozenmd on GitHub (Feb 25, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/77
(summary from opencode):
Description
When vinext detects MDX files and auto-injects
@mdx-js/rollup, the plugin runs too late in the Vite pipeline (aftervite:import-analysis), causing MDX files to fail to compile.Steps to Reproduce
vinext initnpm run dev(vinext)Expected Behavior
MDX files should be transformed before Vite's import analysis runs.
Actual Behavior
The MDX plugin is injected via the
confighook, but plugins returned fromconfigare merged after user plugins. Even withenforce: 'pre', the plugin runs too late.Root Cause
In
packages/vinext/src/index.ts, the MDX plugin is added like this:Plugins returned from the
confighook are merged after user-defined plugins, soenforce: 'pre'doesn't actually make it run early enough.Workaround
Users must manually add
@mdx-js/rollupto theirvite.config.tswithenforce: 'pre':Suggested Fix
Either:
pluginsarray directly (not via config hook)Additional Issues Found During Migration
Node.js 22 glob API breaking change
The
globfunction inapp-router.tsusesexclude: ["**/@*"], but Node.js 22 requiresexcludeto be a function:MDX file extensions not included in routing
app-router.tsglob patterns andfindFilefunction don't include.mdx/.mdextensions, so MDX pages aren't discovered.Environment