Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify env inclusion in bundles #41950

Merged
merged 2 commits into from Oct 28, 2022
Merged

Conversation

jimCresswell
Copy link
Contributor

@jimCresswell jimCresswell commented Oct 27, 2022

Clarify that all next.config.js envs are included in the client-side bundle.

I recently came across an issue where the instructions for specifying environment variables in the next.config.js file and the instructions for specifying them in .env files were conflated, and a value was included in the client-side bundle that was not supposed to be there.

Documentation / Examples

  • Make sure the linting passes by running pnpm lint
  • The "examples guidelines" are followed from our contributing doc

Clarify that all next.config.js envs are included in the client-side bundle.
@jimCresswell
Copy link
Contributor Author

cc @mcky

@balazsorban44
Copy link
Member

FWIW, the recommendation is to use https://nextjs.org/docs/basic-features/environment-variables which has safety checks to exclude environment variables that are only meant for the server.

@kodiakhq kodiakhq bot merged commit 7ef653c into vercel:canary Oct 28, 2022
@jimCresswell
Copy link
Contributor Author

FWIW, the recommendation is to use https://nextjs.org/docs/basic-features/environment-variables which has safety checks to exclude environment variables that are only meant for the server.

@balazsorban44 absolutely, I just wanted to clarify that the safeguarding mechanism doesn't work for the old approach.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants