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
{{ message }}
Repository navigation
React Router, TanStack Start and vinext dev: a cron that imports defineScheduled from 'void' breaks every dev trigger #417
The jobs and queues guides show this import (docs/guide/jobs.md:22, docs/guide/queues.md:19):
import{defineScheduled}from'void';
In a React Router, TanStack Start or vinext app, vp dev cannot load a cron or queue file with this import. A POST to /__void/scheduled returns 500:
The file does not exist at ".../node_modules/.vite/deps_ssr/jiti.js?v=f8fc50fd" which is in the
optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding
it to `optimizeDeps.exclude`.
The terminal shows why. Bare void loaded the Vite plugin itself, and the dependency optimizer tried to bundle Wrangler into the worker:
(ssr) error while updating dependencies:
Error: Error during dependency optimization:
Build failed with 1 error:
[UNRESOLVED_IMPORT] Could not resolve './node.js' in .../blake3-wasm/esm/index.js
imported by .../wrangler/wrangler-dist/cli.js
imported by .../@cloudflare/vite-plugin/dist/index.mjs
One such file breaks every dev cron and queue trigger, because the generated dispatch module imports all of them. Pages still return 200. Production builds are fine, because the cron bundle maps bare void to void/handler.
The response is 500 with the message above, on every try.
Cause
Bare void resolves to the package entry, dist/index.mjs, which is the Vite plugin. Other paths redirect it to the light void/handler entry, but the React Router, TanStack Start and vinext plugin list has no such redirect:
The dev dispatch module imports each cron file into the framework's workerd environment (packages/void/src/plugin-framework-triggers.ts:114).
Suggested fix
Add the same resolveId redirect to the React Router, TanStack Start and vinext plugin list: order pre, filter ^void$, server environments only, resolve to void/handler. Add a dev integration test with a cron that imports defineScheduled from 'void'.
Activity
fix(void): give framework dev crons the handler exports of bare void,…
fix(void): give framework dev crons the handler exports of bare void,…
fix(void): give framework dev crons the handler exports of bare void,…
fix(void): give framework dev crons the handler exports of bare void,…
fix(void): give framework dev crons the handler exports of bare void,…