Skip to content

[Bug?]: Building executable fails in monorepo due to env file in shared package #6803

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

Open
1 task
caralin3 opened this issue May 21, 2025 · 0 comments
Open
1 task
Labels
bug Something isn't working

Comments

@caralin3
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

I have a monorepo created using yarn workspaces where I have this structure.

apps/
    electron/
packages/
    database/

The electron app has the database package as a dependency. And the database package has its own .env file.

// apps/electron/package.json
{
  ...
  "dependencies": {
    ...
    "@notes-app/database": "1.0.0",
  }
}

After I build all of the shared packages, I go to build the electron app for production, but it fails with this:

 ⨯ /Users/notes-app/packages/database/.env must be under /Users/notes-app/apps/electron/  failedTask=build stackTrace=Error: /Users/notes-app/packages/database/.env must be under /Users/notes-app/apps/electron/

I am building the database package via rollup with this:
"build": "rollup -c --bundleConfigAsCjs --environment INCLUDE_DEPS,BUILD:production",

I am building the electron app with this:
"build:mac": "electron-vite build && electron-builder --mac",

How can I get this to work? Do I need to have a shared .env file at the root of the monorepo? Or do I need to build the database package a different way somehow that includes the env variables?

To reproduce

Run yarn run electron:build:mac

Environment

System: OS macOS 14.6.1

Additional context

No response

@caralin3 caralin3 added the bug Something isn't working label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant