David Gilbertson
David Gilbertson

Reputation: 4853

What's the difference between depenencies and devDependencies with NPM 5

The below question refers to a project I'm not publishing to npm.

In NPM 3, if I had a package in devDependencies and ran shrinkwrap (without --development) then npm-shrinkwrap.json would not include the packages in devDependencies.

But with NPM 5, packages in dependencies and devDependencies are added to package-lock.json, with those from devDependencies having "dev": true.

So, if I'm just using npm install x to add packages and npm install to install everything on, say, a build server, is a package listed in dependencies treated any differently from a package listed in devDependencies?

Upvotes: 1

Views: 110

Answers (1)

alexmac
alexmac

Reputation: 19567

It will make sense on production. When you'll need to install all packages, except dev.

npm i --production

From npmjs.org:

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

Upvotes: 2

Related Questions