NPM
is the package manager for Node.js,
NPM is also used to install dependent packages for client side applications
like React, Angular etc. NPM takes care of installing and maintaining the
dependent packages for a project.
The command npm init is used to create a new project, this command will create a project.json file which will record all the dependent packages required for the project. If also records the commands to be executed when we build/run/test the Project.
The package.json file for our Hello World React application looks as follows.
{
The scripts node specifies the various command to be executed on start/build/run/test.
The dependencies node specifies the various depended packages required for Application.
The command npm init is used to create a new project, this command will create a project.json file which will record all the dependent packages required for the project. If also records the commands to be executed when we build/run/test the Project.
The package.json file for our Hello World React application looks as follows.
{
"name":
"ReactHelloWorld",
"version":
"1.0.0",
"description":
"",
"main":
"index.js",
"scripts": {
"start":
"webpack-dev-server --open --mode development",
"build":
"webpack --mode production"
},
"keywords": [],
"author":
"",
"license":
"ISC",
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/preset-react": "^7.9.4",
"babel-loader":
"^8.1.0",
"html-loader":
"^1.1.0",
"html-webpack-plugin": "^4.3.0",
"webpack":
"^4.43.0",
"webpack-cli":
"^3.3.11",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"bootstrap":
"^4.5.0",
"css-loader":
"^3.5.3",
"react":
"^16.13.1",
"react-dom":
"^16.13.1",
"react-redux":
"^7.2.0",
"redux":
"^4.0.5"
}
}The scripts node specifies the various command to be executed on start/build/run/test.
The dependencies node specifies the various depended packages required for Application.
No comments:
Post a Comment