External Package
External packages are those that you install from npm. You've probably been using these since the early days of your JavaScript career so we shouldn't have to explain too much about their fundamentals!
What we will be interested in is how to install packages into the context of your workspaces. Let's take a look.
Always install where the package is needed
When we're working in a monorepo, we have our workspaces creating different scopes within the repository. This means that it's highly probable that the package you're installing doesn't belong in the root of the repository.
Instead, ensure that you install packages within the workspace(s) that they belong in. You can do this in a couple different ways.
- Run the install command while you are in your workspace's directory:
- Or use the workspace flag of your package manager:
For more on how to handle external packages with your package manager, see the page for your respective package manager under Package Managers