Bundled dev mode design doc and Road Map #22746
Replies: 2 comments 1 reply
API consideration documentCopied from my docs, which was written a while ago to plan the whole road map. Required API changesOnes with concrete ideas
Ones without concrete ideas and needs further considerationThese are probably difficult to support as-is.
Other Notes
|
|
Phase 2 Context: we run Lovable, where each user project is a Vite dev server driven by an AI agent (millions of projects; the active fleet is largely React + TanStack Start, currently on Vite 8.1). We've had bundled dev running behind a feature flag since 8.1 and the startup wins are real for us. This is input for the Phase 2 item "Investigate supporting The requirement: suppress-and-replay, not just observe-and-filter. While the agent is mid-edit, files change many times in quick succession and routinely pass through broken intermediate states (half-written modules, transiently unresolved imports). The preview must NOT apply those updates; when the batch completes, we flush — granular updates preferred, full reload as fallback. The flush trigger comes from outside the browser (our backend calls an endpoint on the dev server when the agent's batch is done). In unbundled Vite this is sanctioned and works: In bundled dev there is no equivalent, so today we gate at the transport layer: wrap the HMR WebSocket send path and hold back the patch-fetch responses ( What we'd like the Phase 2 mechanism to support, whatever shape it takes (whether that's #22956's adapter or something else):
Points 1+4 alone would let us delete the transport-layer workaround; 2+3 are what make it correct rather than merely possible. Related, filed separately: #23314 — in current releases, Also registering interest in the Phase 2 We're happy to test design candidates against a large real-world fleet, and to contribute implementation work. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Bundled dev mode was previously called as "Full Bundle Mode".
Background and Motivation
User Guide
Q. As a user, can I use bundled dev mode now?
A. Only if your app does not use any SSR related features from Vite and the third party plugins are compatible. Third party plugins might be compatible, but we don't expect all to work. We'll be publishing plugin author guides in the future.
Q. How can I enable bundled dev mode?
A. You can enable it by
experimental.bundledDevoption or by passing--experimental-bundleflag.Q. Does bundled dev mode bundle my entire app when the dev server starts?
A. No. Bundled dev mode uses lazy bundling (a.k.a. lazy compilation): on startup it only bundles what's needed to render the page the browser actually requests, and compiles the remaining modules on demand as they're imported. This is what keeps startup non-blocking even for large apps because bundling the whole app up front would reintroduce the slow cold starts that Vite's unbundled dev server was designed to avoid. It's enabled by default, so you don't need to configure anything.
Q. Can I disable lazy bundling?
A. You normally shouldn't need to, but it can be turned off. You can set
build.rolldownOptions.experimental.devMode.lazyto opt out for debugging purposes:Key Changes in Mental Models
Since bundled dev mode bundles the files, there will be some changes in the mental models.
new URL("./foo.png", import.meta.url)should be rewritten tonew URL("../relative-path/to/output/foo.png", import.meta.url)Roadmap
Work is sequenced as a series of experimental releases and is subject to frequent adjustment as things progress.
Checked items are complete; unchecked items are planned or in progress.
Phase 1: Basic CSR support
Goal: ship the first experimental release for Vite which is usable for client side rendering apps
Target date: 2026-06-22
Feedbacks are welcome in the feedback discussion!
Phase 2: Complete CSR support
Goal: stabilize for real-world projects beyond the basic scenario. Land the HMR refactor that unblocks plugin support, get incremental rebuilds correct, and expand the support for advanced features like globs.
Target date: 2026-09-10
inputoption (vite#22642): For full bundle mode, the entrypoint has to be specified. Currently, we usebuild.rollupOptions.input, but this is not intuitive for the users.hotUpdate/handleHotUpdate, or whether a different mechanism fits.experimental.hmrPartialAccept)import.meta.globsupport: This requires watching directories, which does not have an API that can be used in plugins.transformIndexHtmlin unbundled mode to full bundle mode / build (vite#20374)this.emitFilememory leak (See rollup#6095)Phase 3: CSS HMR & template coverage
Goal: deliver proper CSS HMR and validate FBM across all create-vite templates.
Target date: 2026-11-12
Phase 4: Server environments
Goal: extend full-bundle mode beyond SPAs to server / SSR environments.
Target date: unknown at this point
TBD
ViteDevServer.ssrLoadModule/env.runner.import: Since importing a random file is not easily possible, these APIs need to change (or Rolldown needs to improve that part). One option is to restrict them to entrypoint files. Another way is to generate the bundle on the fly.ViteDevServer.pluginContainer/env.pluginContainer: difficult for the same reason as "Transforming a single module is not possible."ViteDevServer.transformRequest/env.transformRequest: difficult for the same reason as "Transforming a single module is not possible."ViteDevServer.moduleGraph/env.moduleGraph: a similar functionality is exposed fromthis.getModuleInfo; we can add the lacking functionality there.High Level Explanation of how full bundle mode may work with the module runner
High Level Explanation of how full bundle mode may work with the module runner
ViteDevServer.runner.dispatchFetch(entry)ModuleRunner.import(bundledFileEntry)on the remote runtimeThe difference is that the environment converts
entrytobundledFileEntry.Later
Deferred until after the HMR refactor; needs a feasibility pass (pros / cons / unknowns) before it's scheduled.
import x from './x.png'ornew URL('./x', import.meta.url)inside patches). Expected to touch fewer plugins than the HMR refactor.Plugin Compatibility Notes
Collapsed as it's not stable yet.
Details
ViteDevServer.waitForRequestsIdle: this API does not work with full bundle mode and does not make sense with itchunks/*.transformhook and would requirerenderChunkhook which is not called for HMR patch files. Also, runningrenderChunkhooks of JS plugins are slow.this.addWatchFileto register the dependencies properly.import.meta.globrequires). This will be tackled in the next phase.Current Status
Phase 1 (basic CSR support) is shipped. Work is now focused on Phase 2 (complete CSR support). Phase 4 (server environments) is on the PoC state.
All reactions