zhifez

It works a little like React, sans the “process” prefix (which the compiler will tell you it doesn’t exists).

First, add a “VITE_” prefix to all your variables in your .env file.

Example:

VITE_VARIABLE_NAME=value
VITE_MODE=development

Then, when you want to use it in your Svelte+Vite project, use:

import.meta.env.VITE_VARIABLE_NAME
import.meta.env.VITE_MODE

--

--