firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Allow dotenv files from different environments for SSR and SSG in Next.js

Open chalosalvador opened this issue 1 year ago • 0 comments

Description

This PR is intended to fix the issue #7207 by checking if the .env.<PROJECT-ID> file exists and make it available for the build process.

Scenarios Tested

  1. Initialized a hosting project with Next.js
  2. Created a .env.<PROJECT-ID> file in the root of the Next.js project
  3. Created a page that uses SSR and accesses the environment variable in .env.<PROJECT-ID>
  4. Created a page that uses SSG and accesses the environment variable in .env.<PROJECT-ID>
  5. Deployed the project to Firebase hosting.
  6. Make sure the environment variable in the .env.<PROJECT-ID> is available in a server side rendered page.
  7. Make sure the environment variable in the .env.<PROJECT-ID> is available in a static generated page.

Sample Commands

chalosalvador avatar Jun 14 '24 15:06 chalosalvador