firebase-tools
firebase-tools copied to clipboard
Allow dotenv files from different environments for SSR and SSG in Next.js
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
- Initialized a hosting project with Next.js
- Created a
.env.<PROJECT-ID>file in the root of the Next.js project - Created a page that uses SSR and accesses the environment variable in
.env.<PROJECT-ID> - Created a page that uses SSG and accesses the environment variable in
.env.<PROJECT-ID> - Deployed the project to Firebase hosting.
- Make sure the environment variable in the
.env.<PROJECT-ID>is available in a server side rendered page. - Make sure the environment variable in the
.env.<PROJECT-ID>is available in a static generated page.