What does "dev" true
means in package-lock.json
file?
In my case it is automatically updated when I perform npm
operations.
How can we remove it?
npm install [package-name] –save-dev: When –save-dev is used with npm install, it signifies that the package is a development dependency. A development dependency is any package that absence will not affect the work of the application.
"requires" reflects dependencies from package. json file of this dependency, while dependencies reflects actually installed dependencies in node_modules folder of this dependency.
The package-lock. json file needs to be committed to your Git repository, so it can be fetched by other people, if the project is public or you have collaborators, or if you use Git as a source for deployments. The dependencies versions will be updated in the package-lock. json file when you run npm update .
package-lock. json is updated automatically on dependency changes. It should be committed to version control to ensure the same dependencies on install.
So answering your first question, "dev": true
in package-lock.json
means this dependency won't be installed by npm install
/npm ci
when running in production
mode.
Having dependencies used only for local development environment marked with "dev": true
and then using --production
in your CI might save you some build time.
From documentation https://docs.npmjs.com/cli/install#description:
By default,
npm install
will install all modules listed as dependencies inpackage.json
.With the
--production
flag (or when theNODE_ENV
environment variable is set toproduction
), npm will not install modules listed indevDependencies
.
From the npm docs at https://docs.npmjs.com/files/package-lock.json
If true then this dependency is either a development dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both a development dependency of the top level and a transitive dependency of a non-development dependency of the top level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With