You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Forge cannot correctly detect working dir when use config file #3028
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
6.0.0-beta.70
Electron version
21.2.0
Operating system
macOS 13.0
Last known working Electron Forge version
No response
Expected behavior
A project has forge.config.ts but don't have config.forge in package.json can be treat as forge working dir.
Actual behavior
But not. Forge will look upper dir for packages.json. If you are use mono repo, forge will use package.json in project root.
Steps to reproduce
Forge demo yarn create electron-app my-new-app --template=typescript-webpack and make sure upper dir has an package.json file can reproduce this issue.
Hey @XMLHexagram, just want to make sure I understand your repro case correctly: you're creating multiple Forge projects inside of a monorepo, and each Forge project is trying to use the root directory package.json file instead of their individual forge.config.ts files?
Hey @XMLHexagram, just want to make sure I understand your repro case correctly: you're creating multiple Forge projects inside of a monorepo, and each Forge project is trying to use the root directory package.json file instead of their individual forge.config.ts files?
Well, the same, and they will use their forge.config.ts if they can find the right package.json.
The bug cause Could not find any Electron packages in devDependencies error because root package.json in project root doesn't have electron in devDependencies.
I review forge's source code and find resolve-dir function in core/utils does not fully adapt config file. I did a simple fix in #3029.
Activity
VerteDinde commentedon Oct 31, 2022
Hey @XMLHexagram, just want to make sure I understand your repro case correctly: you're creating multiple Forge projects inside of a monorepo, and each Forge project is trying to use the root directory package.json file instead of their individual
forge.config.tsfiles?XMLHexagram commentedon Oct 31, 2022
Well, the same, and they will use their
forge.config.tsif they can find the rightpackage.json.The bug cause
Could not find any Electron packages in devDependencieserror because rootpackage.jsonin project root doesn't have electron in devDependencies.I review forge's source code and find
resolve-dirfunction in core/utils does not fully adapt config file. I did a simple fix in #3029.XMLHexagram commentedon Oct 31, 2022
Also I think #3019 is the same problem.
MarshallOfSound commentedon Oct 31, 2022
Fixed in b5d0587