[GH-ISSUE #749] Deploy fails with "No such module db" on 0.0.35+ (works on 0.0.33) #164

Open
opened 2026-05-06 12:37:47 +02:00 by BreizhHardware · 2 comments

Originally created by @eduardornj on GitHub (Apr 2, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/749

Bug Description

Deploying to Cloudflare Workers fails with No such module "db" on vinext 0.0.35 and later (tested up to 0.0.38). The same project deploys successfully on vinext 0.0.33.

Error Message

Uncaught Error: No such module "db".

This appears as a Workers validation error (error code 10021) after wrangler deploy succeeds in uploading.

Environment

  • vinext: 0.0.35, 0.0.36, 0.0.37, 0.0.38 (all fail)
  • vinext 0.0.33: works perfectly
  • Node: 22
  • wrangler: 4.73.0
  • Vite: 7.1.3
  • OS: Windows 10
  • Platform: Cloudflare Workers with D1, R2, KV, Durable Objects

Reproduction

Project structure

db/
  index.ts    # exports getDb(), Database type, schema
  schema.ts   # Drizzle ORM schema (SQLite/D1)
lib/
  cron.ts     # imports from "@/db"
  actions/    # server actions import from "@/db"
worker-entry.ts  # custom entry (re-exports vinext + cron + Durable Object)

db/index.ts

import { drizzle } from "drizzle-orm/d1";
import * as schema from "./schema";

export function getDb(d1: D1Database) {
  return drizzle(d1, { schema });
}

export type Database = ReturnType<typeof getDb>;
export { schema };

tsconfig.json paths

{
  "paths": {
    "@/*": ["./*"]
  }
}

worker-entry.ts (custom entry for cron + Durable Objects)

export { default } from "vinext/server/app-router-entry";
export { RateLimiter } from "@/lib/rate-limiter";

import { handleCron } from "@/lib/cron";

export const scheduled = async (event: { cron: string }): Promise<void> => {
  await handleCron({ cron: event.cron });
};

wrangler.jsonc

{
  "name": "arrangelist",
  "compatibility_date": "2026-02-12",
  "compatibility_flags": ["nodejs_compat"],
  "main": "./worker-entry.ts",
  // ... D1, R2, KV, Durable Objects bindings
}

Steps to reproduce

  1. Create a project with a db/ directory using @/db path alias (Drizzle ORM + D1)
  2. Use a custom worker-entry.ts that imports from @/lib/cron (which transitively imports @/db)
  3. npx vinext build succeeds on all versions
  4. wrangler deploy succeeds on 0.0.33 but fails on 0.0.35+ with "No such module db"

Workaround

Pin to vinext 0.0.33:

npm install vinext@0.0.33

Analysis

The build step succeeds on all versions, so TypeScript compilation and bundling work fine. The error occurs at Workers runtime validation, suggesting the @/db path alias is not being resolved correctly in the final Worker bundle starting from 0.0.35.

This may be related to the "Major App Router runtime refactor" in 0.0.35 that extracted modules into smaller per-route bundles, or the tsconfig alias transform fixes mentioned in the changelog.

The custom worker-entry.ts with "main": "./worker-entry.ts" in wrangler.jsonc may be a factor, as it creates a separate entry point that needs the same path resolution as the vinext-managed entry.

Originally created by @eduardornj on GitHub (Apr 2, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/749 ## Bug Description Deploying to Cloudflare Workers fails with `No such module "db"` on vinext 0.0.35 and later (tested up to 0.0.38). The same project deploys successfully on vinext 0.0.33. ## Error Message ``` Uncaught Error: No such module "db". ``` This appears as a Workers validation error (error code 10021) after `wrangler deploy` succeeds in uploading. ## Environment - **vinext**: 0.0.35, 0.0.36, 0.0.37, 0.0.38 (all fail) - **vinext 0.0.33**: works perfectly - **Node**: 22 - **wrangler**: 4.73.0 - **Vite**: 7.1.3 - **OS**: Windows 10 - **Platform**: Cloudflare Workers with D1, R2, KV, Durable Objects ## Reproduction ### Project structure ``` db/ index.ts # exports getDb(), Database type, schema schema.ts # Drizzle ORM schema (SQLite/D1) lib/ cron.ts # imports from "@/db" actions/ # server actions import from "@/db" worker-entry.ts # custom entry (re-exports vinext + cron + Durable Object) ``` ### db/index.ts ```ts import { drizzle } from "drizzle-orm/d1"; import * as schema from "./schema"; export function getDb(d1: D1Database) { return drizzle(d1, { schema }); } export type Database = ReturnType<typeof getDb>; export { schema }; ``` ### tsconfig.json paths ```json { "paths": { "@/*": ["./*"] } } ``` ### worker-entry.ts (custom entry for cron + Durable Objects) ```ts export { default } from "vinext/server/app-router-entry"; export { RateLimiter } from "@/lib/rate-limiter"; import { handleCron } from "@/lib/cron"; export const scheduled = async (event: { cron: string }): Promise<void> => { await handleCron({ cron: event.cron }); }; ``` ### wrangler.jsonc ```jsonc { "name": "arrangelist", "compatibility_date": "2026-02-12", "compatibility_flags": ["nodejs_compat"], "main": "./worker-entry.ts", // ... D1, R2, KV, Durable Objects bindings } ``` ### Steps to reproduce 1. Create a project with a `db/` directory using `@/db` path alias (Drizzle ORM + D1) 2. Use a custom `worker-entry.ts` that imports from `@/lib/cron` (which transitively imports `@/db`) 3. `npx vinext build` succeeds on all versions 4. `wrangler deploy` succeeds on 0.0.33 but fails on 0.0.35+ with "No such module db" ### Workaround Pin to vinext 0.0.33: ``` npm install vinext@0.0.33 ``` ## Analysis The build step succeeds on all versions, so TypeScript compilation and bundling work fine. The error occurs at Workers runtime validation, suggesting the `@/db` path alias is not being resolved correctly in the final Worker bundle starting from 0.0.35. This may be related to the "Major App Router runtime refactor" in 0.0.35 that extracted modules into smaller per-route bundles, or the tsconfig alias transform fixes mentioned in the changelog. The custom `worker-entry.ts` with `"main": "./worker-entry.ts"` in wrangler.jsonc may be a factor, as it creates a separate entry point that needs the same path resolution as the vinext-managed entry.
Author
Owner

@james-elicx commented on GitHub (Apr 2, 2026):

Are you able to share a git repository with the reproduction by any chance?

<!-- gh-comment-id:4176143327 --> @james-elicx commented on GitHub (Apr 2, 2026): Are you able to share a git repository with the reproduction by any chance?
Author
Owner

@eduardornj commented on GitHub (Apr 2, 2026):

Here's the minimal reproduction: https://github.com/eduardornj/vinext-repro-749

Key structure:

  • db/index.ts — exports getDb(), imported as @/db via tsconfig paths
  • lib/cron.ts — imports from @/db
  • worker-entry.ts — custom entry ("main" in wrangler.jsonc) that imports @/lib/cron, which transitively imports @/db

To reproduce:

npm install
npm install vinext@0.0.38
npx vinext build   # succeeds
wrangler deploy    # ERROR: No such module "db"

Rolling back to vinext@0.0.33 and the same deploy succeeds. The build step passes on all versions — the error only appears at Workers runtime validation after upload.

<!-- gh-comment-id:4177370723 --> @eduardornj commented on GitHub (Apr 2, 2026): Here's the minimal reproduction: https://github.com/eduardornj/vinext-repro-749 **Key structure:** - `db/index.ts` — exports `getDb()`, imported as `@/db` via tsconfig paths - `lib/cron.ts` — imports from `@/db` - `worker-entry.ts` — custom entry (`"main"` in wrangler.jsonc) that imports `@/lib/cron`, which transitively imports `@/db` **To reproduce:** ```bash npm install npm install vinext@0.0.38 npx vinext build # succeeds wrangler deploy # ERROR: No such module "db" ``` Rolling back to `vinext@0.0.33` and the same deploy succeeds. The build step passes on all versions — the error only appears at Workers runtime validation after upload.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#164
No description provided.