<aside> ⚠️ Now included in svelte kit

SvelteKit docs

</aside>

Import ENV (old version)

Rules

Variables must be prefixed with VITE_ to be used on the frontend

VITE_MESSAGE="World"

Usage

Access this variable in a .js , .ts  or .svelte file:

const message = import.meta.env.VITE_MESSAGE.toString()

SvelteKit FAQ