#20416·Vite

`envPrefix: ''` forbids starting the dev server

Author: y-nkCreated Jul 17, 2025Updated Sep 17, 2026
Labelspending triage

Describe the bug

In my vite config, i want to set envPrefix: '' because i'm building a backend server locally and i know what i'm doing.

Reproduction

https://example.com/

Steps to reproduce

  1. create a vite project (with a mindset that it'll be for a backend server / ssr)
  2. add envPrefix: ''
  3. run vite

→ my log output:

11:00:46 |      api | error when starting dev server:
11:00:46 |      api | Error: envPrefix option contains value '', which could lead unexpected exposure of sensitive
information.
11:00:46 |      api | at resolveEnvPrefix

Notes

i think a warning is fine, but blocking people from loading env var when they accept their fate isn't ; especially when leveraging vite for building a BE/ssr app

Workaround

Sadly i don't think there's a workaround except for prefixing all my env vars with _ (which sucks). I can't use define since what i wish to accomplish is that import.meta.env gets populated (which seems not to be the case when using define: {})

System Info

System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple MX XXXXXX
    Memory: 109.39 MB / XXXX.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.16.0
    pnpm: 10.10.0

Used Package Manager

pnpm

Logs

No response

Validations