Is it possible to switch already installed packages from "dependencies" to "devDependencies" just by switching lines?

0

Here is an example of the package.json file, installed using the command npm install <nome> --save-dev :

{
"dependencies": {},
"devDependencies": {
"bootstrap": "^4.1.3",
"cross-env": "^5.2.0",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"node-sass": "^4.9.3"
}
}

If I just manually change this way, is something wrong? Out of some convention, or can something else go ahead?

(disregard the functionality of packages, just to illustrate):

{
"dependencies": {
"font-awesome": "^4.7.0",
},
"devDependencies": {
"bootstrap": "^4.1.3",
"cross-env": "^5.2.0",
"jquery": "^3.3.1",
"node-sass": "^4.9.3"
}
}
    
asked by anonymous 19.09.2018 / 04:31

1 answer

2

Yes, you can move packages from your dependencies and devDependencies by editing the package.json file as you described it. You would only be careful doing this to avoid any typing errors (eg in your example, you copied an unnecessary comma at the end of the line just before closing the dependencies keys: "font-awesome": "^4.7.0",

To be more secure, I would use the traditional command:

npm install module --save-prod

To do the inverse (save as devDependency ):

npm install module --save-dev
    
19.09.2018 / 05:05