If I use api.imply in package.js do I have to use

2019-04-28 18:54发布

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']);

1条回答
神经病院院长
2楼-- · 2019-04-28 19:21

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.

So it means that

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

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

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

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.

查看更多
登录 后发表回答