问题
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:
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.
来源:https://stackoverflow.com/questions/25607825/if-i-use-api-imply-in-package-js-do-i-have-to-use-api-use-for-the-same-package