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#
- Use Vite 8.3.0 and
@tanstack/start-plugin-core 1.171.39.
- Enable
experimental: { bundledDev: true }.
- Add a lazy route with a
createServerFn input validator using Zod.
- 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:
-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.
I'd like to pick this up. The check is still the same on
maininloadViteModuleFromEnvironment.I'll make bundled dev environments use the plugin
loadpath like build mode, as in your diff. I'll also add a regression test for a bundled dev environment and a changeset. Let me know if you'd prefer a different way to detect bundled dev.