SvelteKit provides a good and easy way to use ENV variables:
https://learn.svelte.dev/tutorial/env-static-public
Im using Docker in a CI pipeline to create images. However when running RUN npm run build
in the Dockerfile this leads to the TypeScript error described here: Sveltekit + Typescript: Environment variables build error.
The solution provided in the related answer (i.e. running svelte-kit sync
) is not possible, since in the CI pipeline there is no ENV file during build. Therefore it won't find the variable and the build fails with the error above.
Is there another solution to do this?