#8407·router

start-compiler-plugin fails to lazy-load dependencies with Vite bundledDev

Author: gleknerCreated Sep 12, 2026Updated Sep 12, 2026

Which project does this relate to?

Start

Describe the bug

With Vite experimental.bundledDev, the Start compiler can fail while lazily inspecting a server-function dependency such as Zod.

Bundled environments still report environment.mode === "dev", so loadViteModuleFromEnvironment calls environment.transformRequest(). That path does not load arbitrary modules into Rolldown bundled dev. The compiler cache stays empty and lazy bundling fails with could not load module info.

Steps to reproduce

  1. Use Vite 8.3.0 and @tanstack/start-plugin-core 1.171.39.
  2. Enable experimental: { bundledDev: true }.
  3. Add a lazy route with a createServerFn input validator using Zod.
  4. Open the route.

The lazy bundle fails while loading zod/index.js.

Expected behavior

Bundled dev should use the plugin load hook, like build mode does.

This change fixes the issue locally:

diff
-if (environment.mode === "build") {
+if (environment.mode === "build" || environment.config.isBundled) {

Tested with Vite 8.3.0, Rolldown 1.2.6, React Start 1.168.49, and start-plugin-core 1.171.39.

Related bundled-dev reports: #7488 and #8062, but those cover CSS and HMR rather than compiler dependency loading.