I have a minimal electron app and I am trying to build it (it runs fine). My package.json is
"main": "main.js",
"scripts": {
"start": "electron -r babel-register .",
"package": "build --dir",
"postinstall": "electron-builder install-app-deps"
},
// dependencies
"build": {
"appId": "com.karmadust.mancuspianconvert",
"files": [
"node_modules/**/*"
],
"directories": {
"buildResources": "assets"
}
}
When I run npm run package
I get:
Application entry file "main.js" in the "[path-to-project]/dist/mac/myapp.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.
You need to first build the main electron, you can use electron-webpack
for that:
package.json
"scripts": {
"compile": "electron-webpack",
"build": "yarn compile && electron-builder" // Compile main first
},
"electronWebpack": {
"commonSourceDirectory": "common",
"main": {
"sourceDirectory": "main" // The main folder
},
"renderer": {
"sourceDirectory": null // Ignore any renderer build
},
}
It will create a main
folder inside your dist with the main.js
build-in.
You can take a look at Electron webpack documentation for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With