start-compiler-plugin fails to lazy-load dependencies with Vite bundledDev
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
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-core1.171.39. - Enable
experimental: { bundledDev: true }. - Add a lazy route with a
createServerFninput 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at loadViteModuleFromEnvironment in the Start compiler plugin and reproduce with Vite 8.3.0 using experimental.bundledDev and the lazy Zod validator setup described. Verify that bundled dev uses the plugin load hook and that opening the lazy route no longer fails with “could not load module info” for zod/index.js.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100