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

No info on environment variables in the src folder (#33110) #33136

Merged
merged 4 commits into from Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/advanced-features/src-directory.md
Expand Up @@ -11,7 +11,7 @@ The `src` directory is very common in many apps and Next.js supports it by defau
## Caveats

- `src/pages` will be ignored if `pages` is present in the root directory
- Config files like `next.config.js` and `tsconfig.json` should be inside the root directory, moving them to `src` won't work. Same goes for the [`public` directory](/docs/basic-features/static-file-serving.md)
- Config files like `next.config.js` and `tsconfig.json`, as well as environment variables, should be inside the root directory, moving them to `src` won't work. Same goes for the [`public` directory](/docs/basic-features/static-file-serving.md)

## Related

Expand Down
3 changes: 3 additions & 0 deletions docs/basic-features/environment-variables.md
Expand Up @@ -76,6 +76,9 @@ export async function getStaticProps() {
> CORRECT=pre\$A
> ```

> **Note**: If you are using a `/src` folder, please note that Next.js will load the .env files **only** from the parent
timneutkens marked this conversation as resolved.
Show resolved Hide resolved
> folder and **not** from the `/src` folder.
timneutkens marked this conversation as resolved.
Show resolved Hide resolved

## Exposing Environment Variables to the Browser

By default environment variables are only available in the Node.js environment, meaning they won't be exposed to the browser.
Expand Down