在嵌套范围内发布包 [英] Publishing packages in nested scopes

查看:41
本文介绍了在嵌套范围内发布包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 npm 中使用 @organization-scope/package/sub-package.

I want to use @organization-scope/package/sub-package in npm.

我的package.json如下:-

My package.json is as follows:-

{
  "name": "@once/ui",
  ...
  ...
}

如果我这样做:-

{
  "name": "@once/ui/select-box",
  ...
  ...
}

它给我一个错误,说无效名称.

我正在使用 angular 5.有人可以帮我实现同样的目标吗?

I am using angular 5. Can someone help me do achieve the same?

推荐答案

NPM 中没有嵌套作用域这样的东西.

There is no such thing as a nested scope in NPM.

尝试导入 @once/ui/select-box 会在 @once 的根目录中为您提供一个名为 select-box.js 的文件/ui 包 - 您可以利用此行为来获得接近您想要实现的目标,但发布名称中包含多个斜杠的包是不可能的.

Trying to import @once/ui/select-box would give you a file called select-box.js from within the root of the @once/ui package - you can utilize this behaviour to get something close to what you're trying to achieve, but publishing a package with multiple slashes in the name is not possible.

这篇关于在嵌套范围内发布包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆