Environment variables
Every option except the three below also resolves from an environment variable
with the LIT_PLUGIN prefix. Use them to switch dev-only tooling on per machine
without editing vite.config.ts.
| Env var | Maps to |
|---|---|
LIT_PLUGIN_HMR |
hmr.enabled |
LIT_PLUGIN_HMR_RECONNECT |
hmr.reconnect |
LIT_PLUGIN_HMR_PRIVATE_FIELDS |
hmr.privateFields |
LIT_PLUGIN_HMR_CHILD_STATE |
hmr.childState |
LIT_PLUGIN_HMR_ON_INCOMPATIBLE |
hmr.onIncompatible |
LIT_PLUGIN_HMR_INDICATOR |
hmr.indicator.enabled |
LIT_PLUGIN_HMR_INDICATOR_COUNT |
hmr.indicator.count |
LIT_PLUGIN_SOURCE_OVERLAY |
sourceOverlay (enable) |
LIT_PLUGIN_SOURCE_OVERLAY_KEY |
sourceOverlay.key |
LIT_PLUGIN_SOURCE_OVERLAY_EDITOR |
sourceOverlay.editor |
LIT_PLUGIN_SOURCE_OVERLAY_THROTTLE_MS |
sourceOverlay.throttleMs |
LIT_PLUGIN_TIMELINE |
timeline (enable) |
LIT_PLUGIN_CSS_SHEET_BUILD |
cssSheetBuild |
LIT_PLUGIN_DEVTOOLS_WORKSPACE |
devtoolsWorkspace |
Precedence
Section titled “Precedence”Per setting, the value passed to litPlugin() wins over the environment
variable, which wins over the built-in default.
Precedence applies to each setting on its own, not to the group it sits in. So
litPlugin({hmr: {reconnect: true}}) fixes reconnect, and
LIT_PLUGIN_HMR_INDICATOR_COUNT=1 still reaches the indicator.
A live override from the DevTools Settings tab sits above all three, for
the settings it can change. The tab labels a value set by env or an option
with its layer, such as Zed (env); a built-in default carries no label. While an override is active
the row names the value it replaced, such as env: Zed, so you can tell what
a reset restores.
How values are parsed
Section titled “How values are parsed”- Booleans accept
true,1,false, and0. Any other value counts as unset, and the option falls through to its default. - Numbers must parse as a number.
LIT_PLUGIN_SOURCE_OVERLAY_THROTTLE_MSis the only one. An unparsable value counts as unset. LIT_PLUGIN_CSS_SHEET_BUILDis checked against the four allowed values. Anything else logs a warning and falls back to the default.LIT_PLUGIN_SOURCE_OVERLAY_EDITORmust name a built-in editor:vscode,cursor,zed,ideaorwindsurf. Anything else logs a warning and falls back to the default. A custom editor object can only be passed as thesourceOverlay.editoroption.LIT_PLUGIN_DEVTOOLS_WORKSPACEtakes a boolean to turn the workspace reply on or off. Any other value is the folder to serve, relative to Vite’sroot.
Options with no environment variable
Section titled “Options with no environment variable”Three options are config-only. sourceOverlay.exclude and
sourceOverlay.onSelect are functions, and sourceOverlay.workspaceRoot is a
path that belongs next to the rest of your build config.
Example
Section titled “Example”# Dev-only tooling, switched on without touching vite.config.ts.LIT_PLUGIN_TIMELINE=trueLIT_PLUGIN_SOURCE_OVERLAY=trueLIT_PLUGIN_SOURCE_OVERLAY_EDITOR=zedLIT_PLUGIN_SOURCE_OVERLAY_THROTTLE_MS=16LIT_PLUGIN_HMR_INDICATOR_COUNT=1The plugin reads these through Vite’s loadEnv, so they follow Vite’s usual
.env resolution: .env, .env.local, and the mode-specific variants.