I have two addons, one of which contains a module that I'd like to use in the other. How can I import from the first addon into the second?
I have tried a few different approaches, including exposing the required module in both addon-1/addon/... tree and addon-1/app/... tree but to no avail.
This is how it currently stands:
Addon 1
addon-1/
addon/
lib/
my-module.js
app/
lib/
my-module.js
The files:
# addon-1/addon/lib/my-module.js
export MyModule;
# addon-1/app/lib/my-module.js
import MyModule from 'addon-1/lib/my-module';
export MyModule;
Addon 2
addon-2/
addon/
lib/
some-other-module.js
The files:
# addon-2/addon/lib/some-other-module.js
import MyModule from 'lib/my-module';
export MyModule.extend(/* extending the imported module */);
# alternative version, also fails
import MyModule from 'addon-1/lib/my-module';
export MyModule.extend(/* extending the imported module */);
This results in an error when trying to build addon-2 for testing:
ENOENT, no such file or directory '/path/to/addon/tmp/tree_merger-http://...tmp/lib/my-module.js'
I assumed the trees would be merged and my-module would be accessible via addon-2's tree as when modules are used within apps.
Am I missing something obvious here?
Aucun commentaire:
Enregistrer un commentaire