I am using Webpack 3 to bundle two separate Aurelia apps on the same page.
One is the main body of the application and uses the standard setRoot
method:
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
aurelia.start().then(a => {
aurelia.setRoot(PLATFORM.moduleName('shells/app'),
document.getElementById('AppBodyContainer'));
});
}
The other uses the enhance method on an old MVC view
const enhanceNode = (app, node, bindingContext = null) => {
const engine = app.container.get(TemplatingEngine);
const component = engine.enhance({
container: app.container,
element: node,
resources: app.resources,
bindingContext: bindingContext
});
component.attached();
};
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
aurelia.start().then(a => {
enhanceNode(a, document.getElementById('HeaderContainer'));
});
}
Both are standalone aurelia apps, and both use the webpack AureliaPlugin
new AureliaPlugin({
aureliaApp: 'header-app'
}),
The problem is that whenever both are on the same page, the separate version of aurelia-binding
are interfering with each other, which means that anything bound through click.delegate
is fired twice on click.
What am I doing wrong?