DEV Community

loading...

Discussion on: Using environment variables in SvelteKit (and Vite)

Collapse
p6gb profile image
p6gb

That might have been it. I am now adding the env variables to session in a hook:

export function getSession() {
    return {
        API_ENDPOINT: import.meta.env.VITE_API_ENDPOINT
    };
}
Enter fullscreen mode Exit fullscreen mode
Thread Thread
timdeschryver profile image
Tim Deschryver

That's smart!