NoHoist在纱线Monorepo中的整个包装
Yarn添加了 nohoist
选项,让我们将单个依赖性排除在吊装之外。但是,有没有办法将整个软件包及其依赖性排除在吊装之外?
示例:我有一个后端软件包@mono/server
和一个frontend软件包@mono/frontend
。我现在想从提升中排除整个后端软件包,其依赖关系和亚依赖性。
这可能吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
纱线1.x没有这样的功能。
您提到的功能
nohoist
在YARN 2.0中删除。纱线2.3中有一个新功能,称为
nmhoistinglimits
,它是“ dependenty”
选项,选项已接近您的要求。查看更多:您可以通过消除公共祖先package and of the of tos的东西来完成类似的事情。该结构将是类似的:
如果要防止
Server
的依赖关系,则稍作逐渐减少,那么看起来server
andfrontend
>没有共同的依赖关系。在这种情况下,将其视为两个单独的包裹可能会有用,从而使祖先消除的想法更加行进?Yarn 1.x does not have such a feature.
The feature you mention
nohoist
was removed in yarn 2.0.There is a new feature in yarn 2.3 called
nmHoistingLimits
, and it's"dependency"
option is getting close to what you are asking for. See more:https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h#nohoist
You could accomplish something similar to what you are asking for by eliminating the common ancestor package.json. The structure would be something like:
And stepping back a bit, if you want to prevent hoisting of dependencies of
server
, then it seemsserver
andfrontend
don't have dependencies in common. In that situation perhaps it would be useful to think of these as two separate packages, giving the common ancestor elimination idea more creedance?