Skip to content
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

Treating "electron" as peerDependencies will cause some problems #1

Open
minikinl opened this issue Jun 4, 2024 · 0 comments
Open

Comments

@minikinl
Copy link

minikinl commented Jun 4, 2024

"electron": ">=15.0.0"

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant