Let's say I import an .env variable using
import { PUBLIC_URL } from '$env/static/public';
If the variable does not exists, it will throw an HTTP 500 Internal Server error
and I can read the error in the console.
Now if someone else clones the repository and does not have an .env
file, I would like to catch this error message and throw a decent error description.
How can I achieve this?
I tried using fs.exists()
, but it seems that I am unable to use fs
in Svelte. I also tried importing dotenv
and running config. It gives an error process is not defined
, when the file does exist.