In Repo Addon - Cannot import on app.js


#1

Good Morning everyone,

I’ve been working with ember for about two months and am stuck with the in-repo addon. This is my first time with addon’s in general. I’ve created the addon, updated the index.js in the lib addon folder, updated the package.json in the main project folder to include the addon, however on import from my main app.js i’m getting a not found. I know i’m missing some key piece that connects the addon to ember. Spent a few hours combing through github repos (3 years old so maybe out of date), and couldn’t find a working example to see how this is done. I’ve tried various flavors of import on app.js from ./shared-components, lib/shared-components, lib/shared-components/index, etc.

The goal is to simply access methods in the addon.

Any help would be appreciated.

project package.json

“ember-addon”: { “paths”: [ “lib/shared-components” ] }

Addon package.json

“name”: “shared-components”, “keywords”: [ “ember-addon”, “shared-components” ] }

standard index.js in addon lib/shared-components folder

module.exports = { name: ‘shared-components’, isDevelopingAddon: function() { return true; } };

application.js

import ‘./shared-components’;

Console error


#2

instead of linking addon package in package.json try to use npm link. It works for me.