sveltekit-environment-variable-playground Svelte Themes

Sveltekit Environment Variable Playground

Playground to test environment variable access in a SvelteKit project

Playground to test environment variable access in a SvelteKit project

In this playground, I test the following SvelteKit features:

Getting start:

$ mise install
$ pnpm install

Load environment variables:

$ source .envrc
$ pnpm run dev

Open your browser on: http://localhost:5173/

In your terminal you see:

POSTGRESQL_URL: postgresql://myuser:mypassword123@localhost:5432/mydatabase

In your browser, you can see:

Now, compile and run the compiled version with specific environment variable assignment:

$ pnpm run build
$ PUBLIC_VERSION="0.2.0" PUBLIC_GOATCOUNTER_ENDPOINT="https://foobar.com/count" pnpm run preview

Open your browser on: http://localhost:4173/

In your terminal you see:

POSTGRESQL_URL: postgresql://myuser:mypassword123@localhost:5432/mydatabase

In your browser, you can see:

Top categories

Loading Svelte Themes