Skip to content

Bug Report: Uncaught Error: No such module "wrangler:modules-watch" when running wrangler pages dev on Nitro build #14845

Description

@hpx07

What versions & operating system are you using?

OS: Windows
Wrangler Version: 4.114.0 (or current)
Node.js Version: v24.14.0
Framework: Nitro (version 3.0.260603-beta), TanStack Start, Vite 8.1.5

Please provide a link to a minimal reproduction

https://github.com/hpx07/nitro-wrangler-bug-repro

Describe the Bug

When running npx wrangler pages dev .output/public on a project built with Nitro (using the cloudflare-module preset), the Workers runtime fails to start due to a missing module error related to wrangler:modules-watch.

Wrangler seems to be attempting to inject development-only "watch" code into a context where it is not supported or where the module is completely absent from the environment, causing a runtime exception.

Steps to Reproduce
Create a project utilizing Nitro with the cloudflare-module preset (e.g., using TanStack Start and @lovable.dev/vite-tanstack-config).
Run the build command (e.g., npm run build or vite build) which generates the .output directory containing .output/server and .output/public.
Run npx wrangler pages dev .output/public.
Observe the local server starting but instantly crashing with a module not found error.

Please provide any relevant error logs

X [ERROR] service core:user:6c8b0a88-a35e-44d4-bb41-924dac6e77da: Uncaught Error: No such module "wrangler:modules-watch".

imported from "pages-shim.js"

X [ERROR] The Workers runtime failed to start. There was likely a problem with the workerd binary or your configuration.

Runtime stderr:
{"timestamp":"1785003887790","level":"error","source":"src/workerd/server/json-logger.c++:127","message":"service
core:user:6c8b0a88-a35e-44d4-bb41-924dac6e77da: Uncaught Error: No such module
"wrangler:modules-watch".\n imported from "pages-shim.js"","context_depth":0}

wrangler_bug_report.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:wranglerRelating to the `wrangler` packageproduct:pagesRelating to Cloudflare Pages: https://pages.cloudflare.com/

    Type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions