I’m trying to move existing working code in a plugin for sharing between my web application and my electron application. I decided to use the https://github.com/aurelia-toolbelt/aurelia-plugin-skeleton-typescript as my starting point.
I’m having issues using classes from the plugin in my application. I beleive I’m doing what I should be. My plugin index.js looks like this.
import { FrameworkConfiguration } from "aurelia-framework";
export { CustomControlFactory } from "./customControlFactory";
export { ViewStateMode} from "./models/viewState";
export function configure(config: FrameworkConfiguration) {
config.globalResources("./control-view");
config.aurelia.use
.plugin("aurelia-validation")
.plugin("aurelia-kendoui-bridge");
}
ViewStateMode and CustomControlFactory are the 2 classes I need exposed to any application consuming this plugin and they can’t be found.
My sample project page looks like this
<template>
<section>
${title}<br>
<control-view controls.bind="controls"></control-view>
</section>
</template>
import { Router } from "aurelia-router";
import { autoinject } from "aurelia-framework";
import { CustomControlFactory } from "../../custom-controls/customControlFactory";
import { ViewStateMode } from "../../custom-controls/models/viewState";
@autoinject
export class Page1 {
public title: string;
constructor(public router: Router, private customControlFactory: CustomControlFactory) {
this.customControlFactory.loadControls([], ViewStateMode.all, false);
}
public canActivate(_a: any, b: any, _c: any) {
this.title = b.title;
}
}
I know customControlFactory is actually working as it’s injected into the control-view and I can see it spitting out my debug messages when it gets instantiated, i just can’t use this class to do what I really need it to do, which is loadControls.
Here is my error output. Do i need to do something special to Fusebox?
ERROR [app-router] Error: "
Fusebox-loader _import() telling this not registered in the loader:routes/page1, module path returned: ~/routes/page1
Did you forget to add it to bundle?
TypeError: customControlFactory_1 is undefined
"
_importhttp://localhost:4444/vendor.js:312740:35stephttp://localhost:4444/vendor.js:312549:18verbhttp://localhost:4444/vendor.js:312530:53__awaiterhttp://localhost:4444/vendor.js:312524:15__awaiterhttp://localhost:4444/vendor.js:312520:12_importhttp://localhost:4444/vendor.js:312709:16loadModulehttp://localhost:4444/vendor.js:312687:39stephttp://localhost:4444/vendor.js:312549:18verbhttp://localhost:4444/vendor.js:312530:53__awaiterhttp://localhost:4444/vendor.js:312524:15__awaiterhttp://localhost:4444/vendor.js:312520:12loadModulehttp://localhost:4444/vendor.js:312673:16importViewModelResourcehttp://localhost:4444/vendor.js:307021:12ensureViewModelhttp://localhost:4444/vendor.js:308341:14loadRoutehttp://localhost:4444/vendor.js:298151:12loadComponenthttp://localhost:4444/vendor.js:293986:10loadRoutehttp://localhost:4444/vendor.js:293959:10loadPromiseshttp://localhost:4444/vendor.js:293923:12loadNewRoutehttp://localhost:4444/vendor.js:293922:22runhttp://localhost:4444/vendor.js:293914:12nexthttp://localhost:4444/vendor.js:292583:18iteratehttp://localhost:4444/vendor.js:293692:12processDeactivatablehttp://localhost:4444/vendor.js:293695:10runhttp://localhost:4444/vendor.js:293626:12nexthttp://localhost:4444/vendor.js:292583:18runhttp://localhost:4444/vendor.js:293055:14 vendor.js:289671:6
ERROR [app-router] Router navigation failed, and no previous location or fallbackRoute could be restored. vendor.js:289671:6
../../custom-controls/customControlFactory not found on request vendor.js:323469:2249
../../custom-controls/models/viewState not found on request