I have code that opens a dynamically chosen dialog. This code runs on my test server when I build using the dev
environment but fails when I build using prod
. In prod
, I get the following error:
Uncaught (in promise) Error: Cannot determine default view strategy for object.
My code looks something like this:
//These dialog VMs have an associated .html view of the same name
import {JurorListReportDialog} from './reports/juror-list-report-dialog'
import {GoodJurorReportDialog} from './reports/good-juror-report-dialog'
import {DialogService} from 'aurelia-dialog'
export class SessionReports{
public reports : Report[] = [
new Report("SessionJurorList", "Juror List", "...", JurorListReportDialog),
new Report("GoodJurors", "Good Juror List", "...", GoodJurorReportDialog),
...
]
static inject = [DialogService]
constructor(private dialogService:DialogService){}
//One of the above reports is being passed into this function
public async printReport(report : Report){
if(report.optionDialog){
let result = await this.dialogService.open(
{ viewModel: report.optionDialog,
model: {report: report, session: this.session}
})
.whenClosed(result => { return result; });
}
...
}
}
class Report {
constructor(public name: string,
public title: string,
public description: string,
public optionDialog : any = null){}
}
I’m guessing this has something to do with minification but I have no idea how to correct this and get things working in production.