You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tracking: vinext dev is unusable for this app — every route 404s (workerd/no-fs) or 500s (dev module-runner can't CJS-interop the per-request MDX compile chain) #16
Tracking issue for vinext dev being unusable on this app (reactjs/react.dev, Pages Router). vinext build && vinext start works perfectly; only the dev server is broken. There are two stacked failure modes depending on whether @cloudflare/vite-plugin is active. Related: #6 (a narrow slice of the CJS issue below), #14 (the cloudflare-in-dev half), #15 (why the compile chain runs per-request at all).
Symptom A — with cloudflare() in vite.config (the config vinext deploy requires): every route 404s
vinext deploy requires cloudflare() in a custom vite.config, and it runs unconditionally, so it's active in dev too. @cloudflare/vite-plugin runs the app in workerd, which has no fs. This app's catch-all getStaticProps reads content from disk (see #15), so every page throws and the dev server returns:
GET / -> 404 (content-length: 0, no error in the log)
GET /learn -> 404
GET /learn/installation -> 404
GET /api/md -> 404
GET /robots.txt -> 200 (static assets still serve)
GET /favicon.ico -> 200
A bare 404 with an empty body and no log line makes this very hard to trace — it looks like routing is half-broken rather than "the page handler threw in workerd".
Symptom B — with cloudflare() gated off (dev runs in Node): cascading CJS-interop crashes
Because vinext doesn't prerender in dev (#15), every request runs the full build-time MDX compile chain (remark/retext/babel + metro-cache). vinext's dev SSR module-runner inlines those (old, CJS) packages without CJS interop, so each one throws require/exports/module is not defined. They surface one at a time; each can be silenced by adding it to optimizeDeps.include (+ ssr.optimizeDeps.include), which just reveals the next:
node_modules/parse-numeric-range/index.js ReferenceError: exports is not defined (fatal — dev server exits)
node_modules/tailwindcss/defaultTheme.js ReferenceError: require is not defined (fatal)
node_modules/debounce/index.js ReferenceError: module is not defined (now per-request 500)
node_modules/metro-cache/src/index.js ReferenceError: require is not defined
node_modules/remark/index.js ReferenceError: require is not defined
… still ahead: remark-external-links, remark-images, remark-unwrap-images,
remark-html, retext, retext-smartypants, mdast-util-to-string, unist-util-visit, …
Getting dev to boot this way needs an ~18-entry optimizeDeps.include list that is fragile (breaks whenever any of those transitive packages changes), and dev would still recompile all MDX on every request (slow). Note the first two crashes are fatal (the dev server process exits), not per-request errors.
vinext build --prerender-all && vinext start — all routes 200, real content, no per-request compilation. So the recommended local workflow is vinext start, and this issue tracks making vinext dev actually usable.
Make the dev SSR module-runner apply the same CJS interop the production build already does (the build bundles all of these packages fine), so an app doesn't need to hand-enumerate every transitive CJS dep in optimizeDeps.include.
Tracking issue for
vinext devbeing unusable on this app (reactjs/react.dev, Pages Router).vinext build && vinext startworks perfectly; only the dev server is broken. There are two stacked failure modes depending on whether@cloudflare/vite-pluginis active. Related: #6 (a narrow slice of the CJS issue below), #14 (the cloudflare-in-dev half), #15 (why the compile chain runs per-request at all).Symptom A — with
cloudflare()invite.config(the configvinext deployrequires): every route 404svinext deployrequirescloudflare()in a customvite.config, and it runs unconditionally, so it's active in dev too.@cloudflare/vite-pluginruns the app in workerd, which has nofs. This app's catch-allgetStaticPropsreads content from disk (see #15), so every page throws and the dev server returns:A bare
404with an empty body and no log line makes this very hard to trace — it looks like routing is half-broken rather than "the page handler threw in workerd".Symptom B — with
cloudflare()gated off (dev runs in Node): cascading CJS-interop crashesBecause vinext doesn't prerender in dev (#15), every request runs the full build-time MDX compile chain (remark/retext/babel + metro-cache). vinext's dev SSR module-runner inlines those (old, CJS) packages without CJS interop, so each one throws
require/exports/moduleis not defined. They surface one at a time; each can be silenced by adding it tooptimizeDeps.include(+ssr.optimizeDeps.include), which just reveals the next:Getting dev to boot this way needs an ~18-entry
optimizeDeps.includelist that is fragile (breaks whenever any of those transitive packages changes), and dev would still recompile all MDX on every request (slow). Note the first two crashes are fatal (the dev server process exits), not per-request errors.Root cause
cloudflare()can't be scoped to the deploy build, so dev inherits workerd (no fs) →vinext deploywith a customvite.configfails on missingcloudflare()(and the local-vs-deploy wrangler.jsonc story) #14.getStaticPropsper request instead of prerendering (Pages Router: getStaticProps runs per-request instead of prerendering → fs-backed SSG apps 500 on Cloudflare Workers (needs --prerender-all) #15), dragging the entire build-time compile chain onto the request path, where the dev module-runner can't CJS-interop it (vinext devSSR module-runner doesn't CJS-interop UMD/CJS deps (classnameswindow, parse-numeric-rangeexports) #6 is the first two entries of the list above).What works today
vinext build --prerender-all && vinext start— all routes 200, real content, no per-request compilation. So the recommended local workflow isvinext start, and this issue tracks makingvinext devactually usable.Suggestions
cloudflare()in dev (or give configs a reliable deploy-only signal — seevinext deploywith a customvite.configfails on missingcloudflare()(and the local-vs-deploy wrangler.jsonc story) #14) so dev runs in Node wherefsworks.optimizeDeps.include.getStaticPropsin dev too (Pages Router: getStaticProps runs per-request instead of prerendering → fs-backed SSG apps 500 on Cloudflare Workers (needs --prerender-all) #15) so the heavy compile chain isn't on the request path.Related upstream (cloudflare/vinext)
_next/dataJSON endpoint not implemented cloudflare/vinext#1330 — Pages Router_next/dataJSON endpoint not implemented (OPEN/reopened)getStaticPropsnot prerendered / remote cache (why the compile chain runs per-request)Environment
vinext 0.1.8, Vite 8.1, Node 24, Pages Router, macOS.