Two package.json Structure
Clone this wiki locally
Since version 8 electron-builder rebuilds only production dependencies, so, you are not forced to use two package.json structure.
For development (
package.jsonresides in the root of your project. Here you declare the dependencies for your development environment and build scripts (
For your application (
package.jsonresides in the
appdirectory. Declare your application dependencies (
dependencies) here. Only this directory is distributed with the final, packaged application.
devDependenciesneed to be compiled against your local node.js environment. Thanks to the two
package.jsonstructure, this is trivial (see #39).
- No need to specify which files to include in the app (because development files reside outside the
If you use the two-package.json project structure, you'll only have your
devDependencies in your development
package.json and your
dependencies in your app
package.json. To ensure your dependencies are always updated based on both files, simply add
"postinstall": "install-app-deps" to your development
package.json. This will basically automatically trigger an
npm install within your app directory so you don't have to do this work every time you install/update your dependencies.