如果在package.js中使用api.imply,是否必须对同一软件包使用api.use? [英] If I use api.imply in package.js do I have to use api.use for the same package?

查看:51
本文介绍了如果在package.js中使用api.imply,是否必须对同一软件包使用api.use?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构造流星包时,您可以添加如下文件:

When construction meteor packages you can add files like this:

api.use('fourseven:scss@0.9.4', ['client', 'server']);

您还可以告诉流星,让包裹用户访问其他包裹,如下所示:

You can also tell meteor to give the package user access to other packages like this:

api.imply('fourseven:scss@0.9.4', ['client', 'server']);

在文档中,尚不清楚是否暗示有一个软件包也可用.例如,我不确定这样做是否多余:

In the documentation it's not clear if implying a package also makes it available. For instance, I'm not sure if it is redundant to do this:

api.use('fourseven:scss@0.9.4', ['client', 'server']);
api.imply('fourseven:scss@0.9.4', ['client', 'server']);

推荐答案

我刚刚用几个我的软件包测试了这个用例,我可以断言这意味着一个软件包不会使其在软件包源代码中自动可用

I've just tested this use case with a couple packages of mine and I can assert that implying a package doesn't make it available automatically in the package source.

所以这意味着

api.use("foo:bar@x.y.z");
api.imply("foo:bar@x.y.z");

如果您打算在当前软件包的源文件中使用和引用foo:bar,则

并不是多余的.

is NOT redundant if you intend to use and reference foo:bar in the current package source.

对于应用程序上下文,您可以将api.imply视为api.use,而对当前程序包上下文没有影响.

You can think of api.imply as an api.use for the app context that has no impact on the current package context.

我听说将来他们会计划为应用程序上下文集成类似程序包的API,这将有助于解决加载顺序等问题.

I've heard that some time in the future they plan to integrate a package-like API for the app context, which is going to be useful to address load order among other things.

这篇关于如果在package.js中使用api.imply,是否必须对同一软件包使用api.use?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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