New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass environment variables to build ? #3558
Comments
+1 |
@alxpereira hi bro, do you have any solution to fix this problem? |
for the moment, nope.. I will in the end maybe pass the env file directly in the build process forcing dot-env to parse it directly in my files. But that won't be the final clean solution. |
@alxpereira Hi, my application bulit it with electron-forge & vite-typescript & vue, so I found this https://github.com/electron/forge/issues/3375 can sovle my problem, and BTW I pass NODE_ENV from npm command as environment variable. hope it can help you or give you some inspires. thanks your replay. |
Thanks for reaching out and logging this issue! Because we treat our issues list as the team's backlog, we close issues that are questions since they don't represent a task needing to be completed. For most questions about Electron there are a lot of options. Check out the Electron community. There are also a bunch of helpful people in this Discord that should be willing to point you in the right direction. For your question, I'd recommend the Discord - we have many active help channels and mentors, as well as fellow devs, who can help you out. |
Pre-flight checklist
Electron Forge version
7.2.0
Electron version
v28.2.3
Operating system
macOS 14.2.1
Last known working Electron Forge version
No response
Expected behavior
I have an issue on using the make command and passing env variables.
As on a lot of projects, I'm setting all my env variables in a
.env
file at the root of the project.When running the project using
npm run start
, no issue, everything works well (_VITE and also dotenv related variables are load)But when trying to build the DMG using
npm run make
the variables are not loaded.Actual behavior
The variables are not loaded in main / loader / renderer. (undefined)
Steps to reproduce
Run
npm run make
using a .env file and some variables in the the main or renderer.Additional information
No response
The text was updated successfully, but these errors were encountered: