Open abulka opened 2 years ago
Are you using typescript? If so make sure that your build script in package.json
includes tsc -p electron
. I ran into this issue because I was only compiling the source for my typescript React project but not the electron entry points.
I have this for a react electron app
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && tsc -p electron",
"test": "react-scripts test",
"postinstall": "electron-builder install-app-deps",
"electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && tsc -p electron -w\" \"wait-on http://localhost:3000 && tsc -p electron && electron .\"",
"electron:build": "yarn build && tsc -p electron && electron-builder",
"eject": "react-scripts eject"
},
There is no typescript in my project:
electron-webpack-quick-start1
├──package.json
├──README.md
├──src
│ ├──main
│ │ └──index.js
│ └──renderer
│ └──index.js
└──yarn.lock
My package.json
is
{
"name": "electron-webpack-quick-start",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"dev": "electron-webpack dev",
"compile": "electron-webpack",
"dist": "yarn compile && electron-builder",
"dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null"
},
"dependencies": {
"source-map-support": "^0.5.16"
},
"devDependencies": {
"electron": "8.2.0",
"electron-builder": "^22.4.1",
"electron-webpack": "^2.8.2",
"webpack": "~4.42.1"
}
}
Ok, it is looking for main.js and you have your entry point as main/index.js. I believe what you want is to add "main": "build/src/index.js"
to package.json as your entry point. You can run your dist script and see what the default file it creates is then use that
yeah you need to add at least "main": "your index file"
The README guide suggests using https://www.electron.build/ and thus electron-webpack-quick-start as a recommended way to create a new Electron application. Following this advice results in a project containing
index.js
files which I think is the cause of the GitHub Actions errorwhich I get after creating the recommended
build.yml
file and pushing the project to GitHub. Here is the GitHub Actions error:Following this project's instructions should result in a working GitHub Actions run. At the very least, some instructions should be provided to either change the electron-webpack-quick-start project files to be compatible with the
build.yml
file described in this project's README.md, or vice versa. I'm not familiar enough with webpack and the tooling to know how to do this.