I am creating an electron which running react generated from create-react-app. Then i add nedbjs(a persistence database) and camojs(ODM for nedb) as dependency. To connect react with nedb i use electron ipc.
Here is my project structure:
And here is my package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"electron-dev": "concurrently "cross-env BROWSER=none yarn start" "wait-on http://localhost:3000 && electron ."",
"electron-pack": "build --em.main=build/electron.js",
"electron-release": "build --em.main=build/electron.js --publish=always",
"preelectron-pack": "yarn build",
"preelectron-release": "yarn build"
},
"build": {
"appId": "com.example.cra-electron-boilerplate",
"files": [
"build/**/*",
"node_modules/**/*",
"package.json"
],
"directories": {
"buildResources": "assets"
},
"publish": {
"provider": "github"
}
},
I use command yarn electron-pack to package my app. And then running the unpacked executable from dist folder then got this error:
Here is my repo
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…