NoHoist在纱线Monorepo中的整个包装

发布于 2025-01-26 10:43:04 字数 214 浏览 5 评论 0 原文

Yarn添加了 nohoist 选项,让我们将单个依赖性排除在吊装之外。但是,有没有办法将整个软件包及其依赖性排除在吊装之外?

示例:我有一个后端软件包@mono/server 和一个frontend软件包@mono/frontend 。我现在想从提升中排除整个后端软件包,其依赖关系和亚依赖性。

这可能吗?

Yarn added the nohoist option to let us exclude individual dependencies from hoisting. But is there a way to exclude an entire package and its dependencies from hoisting?

Example: I have a backend package @mono/server and a frontend package @mono/frontend. I now want to exclude the entire backend package, its dependencies and sub-dependencies from hoisting.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俯瞰星空 2025-02-02 10:43:04

纱线1.x没有这样的功能。

您提到的功能 nohoist 在YARN 2.0中删除。
纱线2.3中有一个新功能,称为 nmhoistinglimits ,它是“ dependenty” 选项,选项已接近您的要求。查看更多:

您可以通过消除公共祖先package and of the of tos的东西来完成类似的事情。该结构将是类似的:

@mono/  # no package.json in this folder.
@mono/server/package.json
@mono/frontend/package.json

如果要防止 Server 的依赖关系,则稍作逐渐减少,那么看起来 server and frontend >没有共同的依赖关系。在这种情况下,将其视为两个单独的包裹可能会有用,从而使祖先消除的想法更加行进?

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:

@mono/  # no package.json in this folder.
@mono/server/package.json
@mono/frontend/package.json

And stepping back a bit, if you want to prevent hoisting of dependencies of server, then it seems server and frontend 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文