3. Managing dependencies
3. Managing dependencies
When you want to add, upgrade, or remove dependencies there are a couple of different commands you need to know.
Each command will automatically update your package.json
and yarn-lock
files-
Adding a dependency
If you want to use another package, you first need to add it as a dependency. In order to do that you should run:
yarn add [package]
This will automatically add the [package]
to your dependencies in your package.json
. It will also update your yarn.lock
to reflect the change.
{ "name": "my-package", "dependencies": { + "package-1": "^1.0.0" } }
You can also add other 登录查看完整内容