DEV Community

Sergio Daniel Xalambrí
Sergio Daniel Xalambrí

Posted on • Originally published at


Use a scoped registry with Yarn

When working with private packages we have a few options to use as our registry

  • npm registry
  • GitHub registry
  • Custom registry (e.g. Verdaccio)

If we decide to use the npm registry, and pay for it, we can continue using Yarn and npm without changes. And what if we use another one? And if we want to keep using the npm registry for non-scoped packages?

Enter .yarnrc, create this file inside the project root and write this:

"@company:registry" ""
Enter fullscreen mode Exit fullscreen mode

Now every time you install a package with the @company scope (e.g. @company/design-system) Yarn will use the GitHub registry to download it instead of the public npm registry.

You can use any scope and any URL as a registry, if you setup your own Verdaccio registry under you can add:

"@company:registry" ""
Enter fullscreen mode Exit fullscreen mode

And the best thing is that you can have more than one:

"@frontend:registry" ""
"@backend:registry" ""
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Advice For Junior Developers

Advice from a career of 15+ years for new and beginner developers just getting started on their journey.