I am creating meteor app and I decided to separate it into packages, so I can take control of file loading order.
However, many packages have common dependencies(other external packages) like react
or meteorhacks:flow-router
. I want to create main myapp:app
package with all these dependencies, that other packages in my app will imply.
This is app
package.js:
Package.describe({
name: 'myapp:app',
version: '0.0.1'
});
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
// All external packages that will be used by other local packages
api.use([
'twbs:bootstrap',
], 'client');
api.use([
'ecmascript',
'react',
'meteorhacks:flow-router'
], ['client', 'server']);
});
An I have package myapp:taskslist
that imply myapp:app
:
Package.describe({
name: 'myapp:taskslist',
version: '0.0.1'
});
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
api.imply(['myapp:app']);
api.addFiles([
'client/tasksList.jsx',
'client/task.jsx',
'main.jsx'
], ['client']);
});
However it doesn't work. I have an error No plugin known to handle file 'client/taskList.jsx'
because myapp:tasksList
, does not have react
plugin installed. Shouldn't api.imply()
share react
to myapp:tasksList
package? What's good solution for this problem?
To answer your question directly, no imply
does not expose react
to myapp:tasksList
You need to think of it like this:
IMPLY passes references OUT
USE takes references IN
All the imply in myapp:tasksList
is doing is allowing whatever uses myapp:tasksList
to have access to myapp:app
.
In order for you to use myapp:app
(and all the references it exposes) in myapp:tasksList
you also need to add
api.use([
'myapp:app',
]);
to myapp:tasksList