Adding Dependencies
#
Add modules to the projectYou 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 StructureThis boilerplate uses a two package.json structure. This means you will have two package.json
files.
./package.json
in the root of your project./build/app/package.json
relative to the project root
package.json
file to use#
Which 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 ./build/app/package.json
.
- If the module is native to a platform (like node-postgres), it should be listed under
dependencies
in./build/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.