Today I Learned

3 posts about #ember

How to use in-repo add-on in another in-repo addon

If you like to have access to in-repo addon from the main app you add in your main app package.json the following code:

"ember-addon": {
  "paths": [
    "lib/in-repo-addon"
  ]
}

If you like to have access from your in-repo addon to add-ons in your main app (in this case ember-can) - you would do:

"dependencies": {
  "ember-can": "*",
}

But how to access in-repo add-on #1 in your in-repo add-on #2?

If you like to use a code from in-repo addon #1 in another in-repo addon #2 you have to do it relatively:

In-repo addon #1 package.json:

"ember-addon": {
  "paths": [
    "../in-repo-addon2"
  ]
}

In-repo addon problem with imports from RFC#176

Symptoms:

I was moving a component from base application (Ember 3.3) to in-repo addon.

It uses import from #RFC176:

import { computed } from '@ember/object';

That caused the following error:

Uncaught Error: Could not find module "@ember/object" imported from "in-repo-addon/components/component-name"

Solution:

I had to make sure than in my in-repo addon package.json had the following dependency:

{
  "name": "in-repo addon name",
  "keywords": [
    "ember-addon"
  ],
  "dependencies": {
    "ember-cli-babel": "*"
  }
}

That’s it :)