CloseChoice / CloseChoice/dataframetrainer
Sveltekit does not load environment variables in production
- Dominant language
- Jupyter Notebook
- Stars
- 4
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
In the svelte-docker branch both prod and dev docker compose scripts make the root .env file variables accessible to the frontend container via `env_file: .env` in the respective compose yml files.
The variables are imported inside `src/hooks/server.ts` from `$env/static/private`. When running `npm run dev` in `frontend-svelte/Dockerfile.dev` all variables are avilable but when running `npm run build` in `frontend-svelte/Dockerfile.prod` the variables are not available.
Error Message:
RollupError: "PGHOST" is not exported by "$env/static/private", imported by "src/hooks.server.ts"
The cause of this is likely that vite uses Rollup only when building for production and not when building for development and it seems that the importing of environment variables differs for Rollup
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.