What does " yarn build " command do? Are " npm build " and "yarn build" similar commands?
What does yarn build
command do ?
Are yarn build
and npm build
the same? If not what's the difference?
Solution 1:
yarn build
and npm build
are not existing commands by default. I think you mean yarn run build
or npm run build
.
build
is a command which can be specified in your package.json
file on the scripts
property. See the example below.
{
"name": "mypackage",
"version": "0.1.0",
"scripts": {
"build": "webpack --config webpack.dev.js"
}
}
In this example, build
is a shortcut for launching command webpack --config webpack.dev.js
. You can use every keyword you want to define some shortcuts to launch commands.
And the only difference between the two commands it's the JS dependency manager you're using, yarn or npm.
More infos :
https://yarnpkg.com/lang/en/
https://www.npmjs.com/
Solution 2:
"yarn build Bundles the app into static files for production."