Why do some npm packages have a '@' precedent in the account name and others not in the package-json deps list?

Asked

Viewed 21 times

2

An example would be the package @brazilian-utils/brazilian-utils and luxon, I’ve suspected some of them to be private and others to be public, but Brazilian-utils kills that suspicion. What differentiates the package to have a@by preceding the repository name?

1 answer

2


This is an NPM Feature that allows namespaces in libraries. At work we have about 6 libraries of our own that we load in several projects. Besides being practical to see where it comes from it also allows to avoid limits on names since it allows libraries with the same name but in namespaces different.

Lodash for example exports the library so that it is possible to consume @lodash/debounce as a name in a import debounce from '@lodash/debounce', so with namespace is easier to organize libraries and their sub-components.

  • There in this case the namespace always needs to have the @? After I posted this I found this on npm doc: npm install [<@scope>/]<name>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.