Moving an npm project in JavaScript
The node_modules
folder takes up a
lot of space and contains plenty of small
files. Therefore, when you upload your
project to a hosting or give a project
to a colleague, you shouldn't give a
folder with libraries.
The fact is that your colleague can easily
install the libraries specified in a
package.json
file. Let's see how
it's done. Place the following file
in an empty folder:
{
"dependencies": {
"jquery": "^3.6.1",
"lodash": "^4.17.21"
}
}
Now run the terminal command that will
install all the projects described
in package.json
:
npm install
Let them send you the following
package.json
:
{
"dependencies": {
"jquery": "^3.6.1",
"underscore": "^1.13.6"
},
"devDependencies": {
"webpack": "^5.74.0"
}
}
Put it in an empty folder and run the installation of libraries from this file.