I am encountering a problem with my project in which an environment variable is being revealed to the browser. Despite the documentation stating that only environment variables prefixed with NEXT_PUBLIC_
should be accessible in the browser environment, all of my environment variables are being exposed.
Here's an example: .env.local:
SECRET=SECRET_VALUE
/app/page.tsx
export default function Home(){
return (
<div>{process.env.SECRET}</div>
)
}
The code above displays the value "SECRET_VALUE" in the browser. Here is a straightforward code snippet to reproduce the issue.
Thank you in advance.