In your node project in the file package.json, you may have seen two similar JSON element:
“dependencies”: {
…
}
and
“devDependencies” : {
…
}
devDependencies contains modules which are only required during development.
To save a module as devDependencies on installation, we do:
npm install <module-name> --save-dev
or shortcut:
npm i <module-name> -D
Some examples of dev dependencies are Jest, Chai, Nodemon, Babel, etc.
dependencies contains modules that are required at runtime.
To save a module as run time dependencies, we do:
npm install <module-name> --save
or shortcut:
npm i <module-name> -S
Some examples of runtime dependencies are Express, React, Apollo-client etc.
Comments
Post a Comment