-
-
Notifications
You must be signed in to change notification settings - Fork 549
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
start does not work with yarn workspaces #1377
Comments
refer: #869 |
Just wanted to say that I've tested this in my project with 6.0.0-beta.57 and everything works great, thanks! 🙂 |
Hey @Bosch-Eli-Black, I'm trying to setup a monorepo with a single electron package. I am encountering the same issues faced in #869. I'm running the same version of electron forge but no luck. Any advice, or a minimal repo that demonstrates yarn workspaces working with electron forge? Any help would be greatly appreciated |
Hi @TheFoolishPupil, Sure, would be happy to try to help 🙂 Our directory structure looks like this:
Our enableScripts: true
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-2.4.1.cjs
nodeLinker: node-modules
# We're using Yarn workspaces, which means that by default, all of our modules are hoisted into a node_modules folder that's in the root folder.
# This breaks electron, so we force each folder (app/, web/, and src/) to have their own node_modules folders.
# https://github.com/electron-userland/electron-forge/issues/869
nmHoistingLimits: workspaces Our root {
"name": "...",
"version": "1.0.0",
"description": "...",
"author": "...",
"license": "...",
"private": true,
"scripts": {
"app-run-dev": "yarn workspace example-app run run",
"app-build-prod": "yarn workspace example-app run package"
},
"workspaces": [
"app",
"src"
]
} Our {
"name": "example_app",
"productName": "...",
"version": "0.0.1",
"description": "...",
"author": "...",
"license": "...",
"private": true,
"scripts": {
"run": "electron-forge start",
"package": "electron-forge package"
},
"main": ".webpack/main",
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "example_app"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
}
],
"plugins": [
[
"@electron-forge/plugin-webpack",
{
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"html": "../src/index.ejs",
"js": "./renderer.js",
"name": "main_window"
}
]
}
}
]
]
}
},
"dependencies": {
"electron-squirrel-startup": "1.0.0",
"example-core": "*"
},
"devDependencies": {
"@babel/core": "7.14.3",
"@babel/preset-env": "7.14.2",
"@babel/preset-react": "7.13.13",
"@electron-forge/cli": "6.0.0-beta.57",
"@electron-forge/maker-squirrel": "6.0.0-beta.57",
"@electron-forge/maker-zip": "6.0.0-beta.57",
"@electron-forge/plugin-webpack": "6.0.0-beta.57",
"babel-loader": "8.2.2",
"copy-webpack-plugin": "7.0.0",
"css-loader": "5.2.6",
"electron": "13.0.0",
"file-loader": "6.2.0",
"style-loader": "2.0.0",
"webpack": "5.37.1",
"webpack-cli": "4.7.0",
"webpack-dev-server": "3.11.2"
}
}
Our {
"name": "example-core",
"version": "0.1.0",
"author": "...",
"license": "...",
"private": true,
"dependencies": {
"core-js": "3.10.1",
}
}
|
Thanks for the response. I actually just yesterday got my workspaces working by using plain electron (not electron-forge). I'm not sure what exactly changed as I had attempted that exact thing numerous time last Friday and each time I was getting errors sourcing electron. I appreciate the response and desire to help. :) |
@TheFoolishPupil Glad you got it working! Perhaps the full example will be useful to someone else, anyway 🙂 |
@Bosch-Eli-Black it's nice to see someone else having similar architecture :) by chance have you been able to get it working with PnP (removing |
@easternmotors Indeed! 🙂 No, I've never been able to get electron to work with PnP. The only update to our # We're using Yarn workspaces, which means that by default, all of our modules are hoisted into a node_modules folder that's in the root folder.
# This breaks electron, so we force each folder (app/, web/, and src/) to have their own node_modules folders.
# https://github.com/electron-userland/electron-forge/issues/869
nmHoistingLimits: workspaces |
Note for anyone using Bun: you can create your own symlink'd node_modules folder (create it in the app directory containing electron, and symlink it to the root node_modules in your monorepo). You'll need to create the symlink when you're running the dev server, and destroy it otherwise, as its presence creates problems with |
Preflight Checklist
Issue Details
Expected Behavior
No error
Actual Behavior
To Reproduce
yarn install:all
yarn compile
yarn start
Additional Information
Error log:
This is a code that might relate to this issue
https://github.com/electron-userland/electron-forge/blob/9b8a2a6acbccf280472b0a378451d6520322a542/packages/api/core/src/api/start.ts#L81
The text was updated successfully, but these errors were encountered: