79409950

Date: 2025-02-03 20:35:18
Score: 0.5
Natty:
Report link

Most upvoted solution already gave an answer on how to fix if you still decided to use import.meta.env.

If you don't have to use import.meta.env, you can manually set window.env = { key: process.env[key] } during SSR. This would make the value available when loaded on client, effectively mimic import.meta.env.

An advantage of this is that the Docker user doesn't have to rebuild the image. They can just run the container (with prebuilt image) with their .env file, and the process described above will load it properly.

Reasons:
  • Blacklisted phrase (0.5): upvote
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Trí Nguyễn