vapor-chamber API reference - v1.3.0
    Preparing search index...

    Type Alias VaporChamberHMROptions

    vapor-chamber - Vite HMR plugin

    v1.1.0 — Vapor↔VDOM mode switching: tracks __vapor state during HMR reloads so components switching between Vapor and VDOM modes preserve bus state. v0.5.0 — State-preserving hot module replacement.

    Preserves the shared command bus (handlers, plugins, hooks) across Vite HMR updates so that application state survives component hot-reloads.

    Without this plugin, each HMR update re-creates the bus from scratch, clearing all registered handlers and registered state.

    Tested against: • Vite ≥ 7.0.0 (programmatic build API + library mode) • @vitejs/plugin-vue ≥ 5.0.0 (Vue 3.6 Vapor SFC support — earlier plugin-vue versions only handle 3.5 VDOM and silently skip vapor blocks) • Vue ≥ 3.5.0 (composables) or ≥ 3.6.0-beta.11 (full Vapor surface)

    If you're on plugin-vue v4 the HMR plugin still works for VDOM SFCs but you'll miss Vapor support entirely — Vapor <script setup vapor> blocks fall back to the VDOM compiler. Upgrade plugin-vue alongside Vue 3.6.

    // vite.config.ts
    import { defineConfig } from 'vite'
    import vue from '@vitejs/plugin-vue'
    import { vaporChamberHMR } from 'vapor-chamber/vite'

    export default defineConfig({
    plugins: [vue(), vaporChamberHMR()]
    })
    // main.ts — no changes required; HMR is transparent
    import { createCommandBus } from 'vapor-chamber'
    const bus = createCommandBus()
    bus.register('cartAdd', handler)
    // After HMR: handler is still registered, state is preserved
    type VaporChamberHMROptions = {
        moduleId?: string;
        verbose?: boolean;
    }
    Index

    Properties

    Properties

    moduleId?: string

    Virtual module ID used to share the bus instance across HMR boundaries. Default: 'virtual:vapor-chamber-hmr'

    verbose?: boolean

    Enable verbose logging of HMR events. Default: false