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

updated the environment variables examples to utilize the App router #70392

Open
wants to merge 4 commits into
base: canary
Choose a base branch
from

Conversation

neoFinch
Copy link

This PR updates the environment-variables example to use the App Router. Here are the changes that have been made:

  • Created an app folder and added page.tsx file.
  • Added layout.tsx file
  • Updated the readme.md file.
  • Updated the package.json file.

cc : @samcx

@ijjk ijjk added the examples Issue/PR related to examples label Sep 24, 2024
@ijjk
Copy link
Member

ijjk commented Sep 24, 2024

Allow CI Workflow Run

  • approve CI run for commit: 33007e8

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@neoFinch neoFinch marked this pull request as ready for review September 24, 2024 11:13
@samcx
Copy link
Member

samcx commented Sep 24, 2024

@neoFinch We should add some comments how the Environment Variables will work in development and production in App Router, since previously, there were some comments in the getStaticProps.

E.g., the current console logs will only get ran during the build.

> .../test-examples/environment-variables
> next build

  ▲ Next.js 14.2.13
  - Environments: .env.production, .env

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
   Generating static pages (0/4)  [    ][Node.js only] ENV_VARIABLE: server_only_variable
[Node.js only] ENV_LOCAL_VARIABLE: undefined
[Node.js only] ENV_VARIABLE: server_only_variable
[Node.js only] ENV_LOCAL_VARIABLE: undefined
 ✓ Generating static pages (4/4)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants