Packaging electron plugins


I’m a bit confused about how to build/package an electron app (for Windows) that uses plugins

For example, I installed electron-window-state using npm install electron-window-state --save-dev

It shows up in my dev dependencies:

"devDependencies": {
    "electron": "^1.3.3",
    "electron-builder": "^5.30.0",
    "electron-window-state": "^3.0.3"

When I run the app everything is fine. But then when I package it with electron-builder and open the app it cant find the plugin and crashes

How should I be installing plugins so that they can be packaged correctly?

I’ve also tried npm install electron-window-state --save which adds it as a dependency (as opposed to a devDependency) but the packaged app still cant find it

Am I supposed to include the dep in both package.json files?


A dev dependency should only be used in development, since you want to use electron-window-state in production too it must be installed as a regular dependency. You’ll need to update the app’s package.json, not the other one that’s used for setting up your dev environment.


ah I see, thanks

should electron-window-state be added as a dev dependency in addition to an app one? Or will I already have dev access to it by including it in the app package.json?


No, you don’t need to add it as a dev dependency if you installed it as a regular dependency. Regular dependencies are available in production and development.