-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Can't pull environment variables in TypeScript + Tailwind project #188
Comments
I think we should locate Could you try it? |
You can load the environment variables into process.env using the dotenv package import { config } from 'dotenv';
import isDev from 'electron-is-dev';
config({
path: isDev ? '.env.development' : '.env.production',
}); .env.development: NODE_ENV="development"
CUSTOM_VAR=123
NEXT_PUBLIC_CUSTOM_VAR=456 When prefixed with NEXT_PUBLIC_ you can access them in the renderer/next.js process |
If any troubles or updates, feel free to reopen the issue 🙏 |
This does not appear to work for builds, e.g., 'nextron build' -- any thoughts? |
@jt-l I'm currently not using nextron, when I get back to it i will take a look at this. Sorry! |
I created a
.env
file in root with a hand full ofNEXT_PUBLIC_
environment variables. Trying to log them from/pages/index.tsx
but I'm not seeing any of them.Any clue?
The text was updated successfully, but these errors were encountered: