How to access a component of in-repo-addon in an in-repo-engine

I created an in-repo-addon and an in-repo-engine.

in-repo-addon is meant to contain components which can be shared among host applicaiton and in-repo-engine.

Now in my in package.json of in-repo-engine I included the path to the shared-addon (which is my in-repo-addon) under the key “ember-addons”

And tried to access the component in shared-addon in in-repo-engine

But not working. I tried {{shared-addon/say-hi}} as well .

Why is that??

And also what’s the difference between ember g in-repo-engine … and ember engine … terminal commands

in my company’s application we have an in repo addon with shared stuff (art19-core) and four engines that all use it. In our main application package.json:

  ...
  "ember-addon": {
    "paths": [
      "lib/art19-core",
      "lib/engine1",
      "lib/engine2",
      "lib/engine3",
      "lib/engine4"
    ]
  },
  ...

in each engine package.json:

  ...
  "ember-addon": {
    "paths": [
      "../art19-core"
    ]
  }
  ...

I also see that you’re invoking your component with:

{{shared-addon/components/say-hi}}

This will only work if the component is located in…

lib/shared-addon/addon/components/shared-addon/components/say-hi

If it’s actually just at lib/shared-addon/addon/components/say-hi you would need to invoke it with {{say-hi}} (components from an addon are just mixed into the consuming app namespace via re-exports and that’s how the resolver picks them up)

Yes, that solved my issue. Thank you @dknutsen

Could you just tell what’s the difference between ember g in-repo-engine … and ember engine … terminal commands

I’m not aware of an ember engine command, maybe you’re referring to ember addon some-engine? That would create a “regular” addon which you could write an engine in if you wanted. The ember g in-repo-engine command generates an in-repo addon specifically configured as an engine. When it comes down to it an ember engine is just an ember addon with some special stuff on top. So an engine could either be “in-repo” (same project, installed bundled via file system) or a “regular addon” (separate project, installed via npm/yarn).

The ember engine docs do a pretty good job of explaining the two setups for engines (in-repo vs regular addon).