Quantcast
Viewing all articles
Browse latest Browse all 4826

Understanding Ember's import system

@ppppaaaa wrote:

I'm getting really frustrated with Ember's import system. I can't tell exactly what's going on behind the scenes and all of the ember-cli documentation just tells me how to do specific things and I can't extrapolate based on those examples to my own use-cases. Can anyone shed some light on the steps the importer takes to load a module/addon (I'm interested in both) and what relevant properties are set where in Ember so I can figure out what I need to do?

My specific use cases are as follows:

The first situation I have is an integration test that requires a function from another file. I tried sticking the file in tests/helpers and using a relative import but this GitHub issue says I shouldn't. I just don't know where to put this file and due to the nature of the function, I'd rather not just copy it into the test itself because it is used across multiple tests.

The second situation I have is I have an add-on with a component that's being included in multiple other consuming add-ons. I want to add a dependency to my add-on (specifically ember-lodash b/c I need lodash to merge some objects). When the consuming add-ons try to create an instance of my component, I get an import failure saying it can't find ember-lodash. If I add ember-lodash as a dependency to the apps that consume my add-on, this all works. I feel like this GitHub issue impacts me somehow too but I'm really not sure what I'm supposed to do, especially because ember-lodash doesn't implement include but implements treeForAddon in it's index.js instead...

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles