Aurelia-dialog - Cannot read property 'open' of undefined

I have a project which was created using the Microsoft.AspNetCore.SpaTemplates using the command dotnet new aurelia. I followed the instructions to integrate aurelia-dialog into the project. When I try to invoke the dialog I get the “Cannot read property ‘open’ of undefined” error. I am not getting an instance of DialogService injected into host viewmodel. I’ve tried using both @autoinject and @inject(DialogService) decorators – both exhibit the same behavior.

I’m not sure if this is a webpack issue or an aurelia-dialog issue. Any insight into how to resolve this issue would be greatly appreciated. I can provide my test project if that would be helpful.

I was able to resolve this issue by adding ‘aurelia-dialog’ to webpack.config.vendor.js and rebuilding my vendor assets via webpack --config webpack.config.vendor.js.

Hope this helps others who may face the same issue.

1 Like