api.use(packageNames, [architecture], [options])
Depend on package packagename
.
Arguments
- packageNames String or Array of Strings
-
Packages being depended on. Package names may be suffixed with an @version tag.
In general, you must specify a package's version (e.g.,
'accounts@1.0.0'
to use version 1.0.0 or a higher compatible version (ex: 1.0.1, 1.5.0, etc.) of theaccounts
package). If you are sourcing core packages from a Meteor release withversionsFrom
, you may leave off version names for core packages. You may also specify constraints, such asmy:forms@=1.0.0
(this package demandsmy:forms
at1.0.0
exactly), ormy:forms@1.0.0 || =2.0.1
(my:forms
at1.x.y
, or exactly2.0.1
). - architecture String or Array of Strings
-
If you only use the package on the server (or the client), you can pass in the second argument (e.g.,
'server'
,'client'
,'web.browser'
,'web.cordova'
) to specify what architecture the package is used with. You can specify multiple architectures by passing in an array, for example['web.cordova', 'os.linux']
.
Options
- weak Boolean
-
Establish a weak dependency on a package. If package A has a weak dependency on package B, it means that including A in an app does not force B to be included too — but, if B is included or by another package, then B will load before A. You can use this to make packages that optionally integrate with or enhance other packages if those packages are present. When you weakly depend on a package you don't see its exports. You can detect if the possibly-present weakly-depended-on package is there by seeing if
Package.foo
exists, and get its exports from the same place. - unordered Boolean
-
It's okay to load this dependency after your package. (In general, dependencies specified by
api.use
are loaded before your package.) You can use this option to break circular dependencies.
Please login to continue.