Skip to content

cannot export .env variables in production build #3800

Closed as not planned
Closed as not planned
@vigneshwaran-vtpl

Description

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.6.0

Electron version

v33.3.1

Operating system

mac

Last known working Electron Forge version

No response

Expected behavior

export .env variables in production build

Actual behavior

getting undefined

Steps to reproduce

  1. npx create-electron-app@latest my-new-app --template=vite-typescript
  2. create .env in root & add dotenv
  3. used them in main.ts

Additional information

The production build cannot export .env variables, but it works fine in development mode.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions