electron-conf
electron-conf copied to clipboard
Treating "electron" as peerDependencies will cause some problems
https://github.com/alex8088/electron-conf/blob/66c4648e3236c6dbea0ec719e37428bf3fb4bfc6/package.json#L71
env
npm: v10.2.4 node: v20.11.1
Problems
the peer dependencies was not treated as devDependencies
, so there is no dev
mark in package-lock.json
file.
when we use npm ci --only-production
command to install production dependencies, the electron
package will be installed.
but actually not needed.
"node_modules/electron": {
"version": "30.0.9",
"resolved": "https://registry.npmjs.org/electron/-/electron-30.0.9.tgz",
"integrity": "sha512-ArxgdGHVu3o5uaP+Tqj8cJDvU03R6vrGrOqiMs7JXLnvQHMqXJIIxmFKQAIdJW8VoT3ac3hD21tA7cPO10RLow==",
"hasInstallScript": true,
"dev": true, // <-- this line
"dependencies": {
"@electron/get": "^2.0.0",
"@types/node": "^20.9.0",
"extract-zip": "^2.0.1"
},
"bin": {
"electron": "cli.js"
},
"engines": {
"node": ">= 12.20.55"
}
}
How to Fix
Maybe it is more appropriate to put electron
in devDependencies
or optionalDependencies
.
This problem occurs when I try to optimize the electron application size, pacakger will put electron in node_modules, It takes up 242MB