Skip to content
标签
note
字数
217 字
阅读时间
1 分钟

以这种格式命名的包,遵从这个规范:

@myorg/mypackage

@组织名/包名

这种包被称为 Scoped Package

与其他包的区别

Requiring scoped packages

Because scoped packages are installed into a scope folder, you have to include the name of the scope when requiring them in your code, e.g.

javascript
require('@myorg/mypackage')

There is nothing special about the way Node treats scope folders, this is just specifying to require the module mypackage in the folder called @myorg.

优点

到目前为止,我所看到的作用域的主要优点是,每个作用域都由组织/用户的 npm 帐户控制,非常类似于 GitHub 用户名/组织名称。

通过这种方式,可以很容易地确定您正在查看的包是属于您信任的组织,还是属于第三方工具。

参考

javascript - Use of @ symbol in Node module names - Stack Overflow

贡献者

The avatar of contributor named as jiechen jiechen

页面历史

撰写