How to access class from an aurelia-plugin module


So, I’m trying to create separate npm module which has all the generic components related to an app UI.

To create the module, I cloned the repo: After that, I merged my stuff to the repo and installed the module in my aurelia app wich ended up fine. The app worked as before (when the source was inside the app) .

Now I’ve a problem.

I’m trying to import a class of the module from the App, but they aren’t available… (it says that the module is undefined)

What do I need to made them available?

Sorry, I’m a newbie in this “node, npm, etc…” stuff -.-’

Thanks in advance!


If I understand well you are trying to import class of the module installed from npm or…?


Let me try to explain my steps and what I want to achieve:

1 - Cloned the repo (which is a aurelia plugin skeleton) and named it like my-ui;

2 - Created some components inside the src folder (‘nav-bar’, ‘panel’, etc…);

3 - Installed that local my-ui package in my aurelia app using the command like:

npm install /home/xyz/my-ui

4 - Configured the package in the aurelia.json file doing:

au install my-ui

5 - In the main.js file of the app added aurelia.use.plugin("my-ui");

I know that those steps worked because the components are included sucessfully in the main app. (like nav-bar, side-bar… etc)

Now, I want to use some other component/class inside one component of the main app like:


import {CustomPanel} from 'my-ui';

this.panel = new CustomPanel(document.getElementById('foo'));

But I dont know how to make that possible… :S


Try this:


if you want to import your classes like that then just export them, from your plugin’s index.

// src/index.ts
export { CustomPanel } from './path/to/panel';
export { CoolButton } from './path/to/button';
export * from './utils';


I can highly recommend Dwayne’s great skeleton for a typescript based aurelia-plugin. I’ve written 3 plugins in the discourse of the last two weeks and it worked great so far.