Adding Dependencies
Add modules to the project
You will need to add other modules to this boilerplate, depending on the requirements of your project. For example, you may want to add node-postgres to communicate with PostgreSQL database, or material-ui to reuse React UI components.
tip
Please read the following section before installing any dependencies
Module Structure
This boilerplate uses a two package.json structure. This means you will have two package.json
files.
./package.json
in the root of your project./release/app/package.json
relative to the project root
Which package.json
file to use
Rule of thumb is: all modules go into ./package.json
except for native modules, or modules with native dependencies or peer dependencies. Native modules, or packages with native dependencies should go into ./release/app/package.json
.
- If the module is native to a platform (like node-postgres), it should be listed under
dependencies
in./release/app/package.json
- If a module is
import
ed by another module, include it independencies
in./package.json
. See this ESLint rule. Examples of such modules arematerial-ui
,redux-form
, andmoment
. - Otherwise, modules used for building, testing, and debugging should be included in
devDependencies
in./package.json
.
Further Readings
- See Electron Documentation - Using Native Node Modules to see how Electron uses native Node modules.
- See Node.js Documentation - Addons to see what are native Node modules.
For an example app that uses this boilerplate and packages native dependencies, see erb-sqlite-example.