Skip to content

React Router, TanStack Start and vinext dev: a cron that imports defineScheduled from 'void' breaks every dev trigger #417

Closed

Description

@Brooooooklyn

Problem

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.

Repro

  1. Copy playground/react-router.
  2. Add crons/tick.ts:
    import { defineScheduled } from 'void';
    
    export const cron = '*/5 * * * *';
    
    export default defineScheduled(async () => {
      console.log('tick ran');
    });
  3. Run vp dev, then:
    curl -X POST http://localhost:5173/__void/scheduled \
      -H "x-void-dev-trigger: $(cat .void/dev-trigger-token)" \
      -d '{"cron":"*/5 * * * *","scheduledTime":'"$(date +%s000)"'}'
  4. 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:

Where Redirects bare void
Void apps (packages/void/src/plugin-routing.ts:603-607) yes
SvelteKit dev (packages/void/src/plugin-framework.ts:234-246, added in #413) yes
Production cron/queue bundle (packages/void/src/cli/wrapper.ts:142-147) yes
React Router, TanStack Start, vinext (packages/void/src/index.ts:727-767) no

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'.

Evidence

🤖 Generated with Claude Code

https://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH

Activity

  1. added 5 commits that reference this issue on Oct 14, 2026
    86495f9
    04fa86d
    763b856
    d963d20
    ee0267b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions