LiveVue configuration is managed in your config/config.exs file:
import Configconfig :live_vue, # SSR module selection # For development: LiveVue.SSR.ViteJS # For production: LiveVue.SSR.NodeJS ssr_module: nil, # Default SSR behavior # Can be overridden per-component with v-ssr={true|false} ssr: true, # Vite development server URL # Typically http://localhost:5173 in development vite_host: nil, # SSR server bundle path (relative to priv directory) # Created by Vite "build-server" command ssr_filepath: "./static/server.mjs", # Testing configuration # When false, we will always update full props and not send diffs # Useful for testing scenarios where you need complete props state enable_props_diff: true, # Gettext backend for translating form validation errors # When set, Phoenix.HTML.Form errors are translated using this backend # Example: MyApp.Gettext gettext_backend: nil
Configure component discovery paths in your LiveView module:
lib/my_app_web.ex
defmodule MyAppWeb do def html_helpers do quote do use LiveVue.Components, vue_root: [ "./assets/vue", "./lib/my_app_web", "./lib/my_app_web/components" ] end endend
This generates shortcut functions for your components:
# Instead of<.vue v-component="Counter" v-socket={@socket} /># You can use<.Counter v-socket={@socket} />
Skips during: Live navigation and WebSocket updates
Can be disabled: Per-component with v-ssr={false}
What are “dead renders”?A “dead render” occurs when the page is loaded without an active WebSocket connection - this includes the initial HTTP request before LiveView connects. During this phase, SSR renders the Vue component to HTML on the server so users see content immediately.Once the WebSocket connects (making the view “live”), SSR is skipped because Vue components are already mounted and hydrated client-side.
This gives you the SEO and performance benefits of SSR without the overhead during live updates.
<!-- Force SSR for this component --><.vue v-component="CriticalContent" v-ssr={true} v-socket={@socket} /><!-- Disable SSR for client-only widgets --><.vue v-component="InteractiveChart" v-ssr={false} v-socket={@socket} /><!-- Use global default --><.vue v-component="RegularComponent" v-socket={@socket} />
By default, LiveVue optimizes performance by only sending prop changes (diffs) to the client. During testing, you may need access to the complete props state:
config/test.exs
config :live_vue, enable_props_diff: false
When disabled:
LiveVue will always send full props and not send diffs
The props field returned by LiveVue.Test.get_vue/2 will contain the complete props state
This makes it easier to write comprehensive tests that verify the full component state
This option is primarily intended for testing scenarios. In production, the default behavior (sending only diffs) provides better performance.
The shared_props configuration option was removed in v1.0.0.This feature allowed automatic injection of socket assigns into all Vue components. However, it had a fundamental flaw: LiveView only re-renders components when their explicitly-passed assigns change.Workaround: Pass props explicitly in your templates: