Code quality
Dependencies that leak server settings
Avoid packages that pull server-only environment variables into the browser bundle.
Why it matters
Some packages are meant for the server but get bundled into the browser by the framework. When that happens, every variable they read can be exposed.
Removing the package, or loading it only on the server, prevents a leak that is hard to notice in the code.
How to fix it
-
Check which dependencies end up in the browser bundle
-
Remove server-only packages from client code
-
Keep secrets out of variables that the client can read
Prompt for an AI assistant
Copy the text below and paste it into an AI assistant.
You are the person improving this website. Check the item below and fix it if it applies to the site. Item: Dependencies that leak server settings Summary: Avoid packages that pull server-only environment variables into the browser bundle. Steps: 1. Check which dependencies end up in the browser bundle 2. Remove server-only packages from client code 3. Keep secrets out of variables that the client can read References: - Vite: Env variables and modes (https://vitejs.dev/guide/env-and-mode) Constraints: - Keep the existing design and tone of voice. - Show the file or section you changed and the suggested final wording. - Do not decide ambiguous points alone; give options and a recommendation. - Do not change anything outside the listed item.
Related checks
-
Secrets in client JavaScript
Keep API keys and tokens out of the JavaScript that browsers download.
-
.env files with secrets in the repository
Do not commit .env files that contain real secrets. Commit an example file with empty values instead.
References
-
Vite: Env variables and modes
Vite documentation(Official)
Check your site now
Enter a URL and find what is missing before launch, for free.
Run audit