Move a module from devDependencies to dependencies in npm package.json
Yes! to move a module from devDependencies
to dependencies
:
npm install <module_name> --save-prod
Shorthand to move from devDependencies
to dependencies
(prod):
npm i <module_name> -P
If you want to do the opposite (i.e. move a module from dependencies
to devDependencies
) just do:
npm install <module_name> --save-dev
or shorthand:
npm i <module_name> -D
In yarn:
Move a module from devDependencies
to dependencies
:
yarn remove <module_name> --dev && yarn add <module_name>
Move a module from dependencies
to devDependencies
:
yarn remove <module_name> && yarn add <module_name> --dev
As said in the comments, the command actually deletes the module and reinstall it in the new place.