FullBundleDevEnvironment Class — vite Architecture
Architecture documentation for the FullBundleDevEnvironment class in fullBundleEnvironment.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 8fcd8920_61ef_93b8_499a_c18a48b852e5["FullBundleDevEnvironment"] f070fb78_2f2a_ef11_0530_d34862fa95ca["fullBundleEnvironment.ts"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|defined in| f070fb78_2f2a_ef11_0530_d34862fa95ca 4ae1a360_4ea9_bed5_a7fe_a0731ef954f2["constructor()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 4ae1a360_4ea9_bed5_a7fe_a0731ef954f2 848ddbbd_3d45_b055_e84a_874b4ca3fd45["listen()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 848ddbbd_3d45_b055_e84a_874b4ca3fd45 9d14b302_f3e1_c6ad_ee27_ab91f346722a["waitForInitialBuildFinish()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 9d14b302_f3e1_c6ad_ee27_ab91f346722a 98bdaae6_bc72_05d1_f51a_469bced673c2["warmupRequest()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 98bdaae6_bc72_05d1_f51a_469bced673c2 55a72845_539c_1cc5_148b_2c87bf18e4db["invalidateModule()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 55a72845_539c_1cc5_148b_2c87bf18e4db 202ab9f4_58a5_311d_2d48_4d57ff3e4b5c["triggerBundleRegenerationIfStale()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 202ab9f4_58a5_311d_2d48_4d57ff3e4b5c e8056252_150f_b824_9d2d_7bdea9fc8dad["close()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| e8056252_150f_b824_9d2d_7bdea9fc8dad e6c19722_5c65_17df_83d9_4bb453d26d5b["getRolldownOptions()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| e6c19722_5c65_17df_83d9_4bb453d26d5b 2ccc36f4_103c_b60e_efaa_01ea14db6138["handleHmrOutput()"] 8fcd8920_61ef_93b8_499a_c18a48b852e5 -->|method| 2ccc36f4_103c_b60e_efaa_01ea14db6138
Relationship Graph
Source Code
packages/vite/src/node/server/environments/fullBundleEnvironment.ts lines 62–368
export class FullBundleDevEnvironment extends DevEnvironment {
private devEngine!: DevEngine
private clients = new Clients()
private invalidateCalledModules = new Map<
NormalizedHotChannelClient,
Set<string>
>()
private debouncedFullReload = debounce(20, () => {
this.hot.send({ type: 'full-reload', path: '*' })
this.logger.info(colors.green(`page reload`), { timestamp: true })
})
memoryFiles: MemoryFiles = new MemoryFiles()
constructor(
name: string,
config: ResolvedConfig,
context: DevEnvironmentContext,
) {
if (name !== 'client') {
throw new Error(
'currently full bundle mode is only available for client environment',
)
}
super(name, config, { ...context, disableDepsOptimizer: true })
}
override async listen(_server: ViteDevServer): Promise<void> {
this.hot.listen()
debug?.('INITIAL: setup bundle options')
const rollupOptions = await this.getRolldownOptions()
// NOTE: only single outputOptions is supported here
if (
Array.isArray(rollupOptions.output) &&
rollupOptions.output.length > 1
) {
throw new Error('multiple output options are not supported in dev mode')
}
const outputOptions = (
Array.isArray(rollupOptions.output)
? rollupOptions.output[0]
: rollupOptions.output
)!
this.hot.on('vite:module-loaded', (payload, client) => {
const clientId = this.clients.setupIfNeeded(client)
this.devEngine.registerModules(clientId, payload.modules)
})
this.hot.on('vite:client:disconnect', (_payload, client) => {
const clientId = this.clients.delete(client)
if (clientId) {
this.devEngine.removeClient(clientId)
}
})
this.devEngine = await dev(rollupOptions, outputOptions, {
onHmrUpdates: (result) => {
if (result instanceof Error) {
// TODO: send to the specific client
for (const client of this.clients.getAll()) {
client.send({
type: 'error',
err: prepareError(result),
})
}
return
}
const { updates, changedFiles } = result
if (changedFiles.length === 0) {
return
}
if (updates.every((update) => update.update.type === 'Noop')) {
debug?.(`ignored file change for ${changedFiles.join(', ')}`)
return
}
for (const { clientId, update } of updates) {
const client = this.clients.get(clientId)
if (client) {
this.invalidateCalledModules.get(client)?.clear()
Domain
Source
Frequently Asked Questions
What is the FullBundleDevEnvironment class?
FullBundleDevEnvironment is a class in the vite codebase, defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts.
Where is FullBundleDevEnvironment defined?
FullBundleDevEnvironment is defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts at line 62.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free