Search code examples
javascriptember.jsember-addonember-engines

how to use in-repo-addons in the ember-engines?


I have created and ember in-repo-addon. Let's say say-hello. After that I created ember-eninge. Let's say users-engine.

In may main application I can directly use the addon as

//application.hbs
{{say-hello}}

How to use it in the users-engine ?

//lib/users-engines/templates/index.hbs
{{say-hello}} //It is not working also not throwing any error 

Solution

  • I found the answer but not sure whether it is correct way or not.

    In the users-engine/package.json add relative path to addons

    {
      "name": "users-engine",
      "keywords": [
        "ember-addon",
        "ember-engine"
      ],
      "dependencies": {
        "ember-cli-htmlbars": "*"
      },
      "ember-addon": {
        "paths": [
          "../say-hello"
        ]
      }
    }
    

    and now you can use in-repo-addon in ember-engine directly.

    //lib/users-engines/templates/index.hbs
    {{say-hello}} //It is working now.