How do I use Electron app environment variables

I am creating a Point of Sale using electron js. I want to use environment variables for the source of the API where the backend is coming from. I installed the environment variables using the command npm install dotenv and Im am using .env as the source of environment variables. The following is my folder structure.Folders Structure.
My main window is the login page which is here. Its working well with the .env Login Page Folder.Use of .env on login. When I try to use the environment variables within other pages which are in the pages folder I am getting the error.Add warehouse page error. The following is how the code is structured.add warehouse page Is there a way to fix this or any alternative methods?

I tried to do webpack configurations but maybe I couldn’t do them right.