bpmn-js work correctly in develop mode but in production, the mode does not work and get this exception
main.b4182912367c0c2773c0.js:1 ERROR TypeError: Cannot read property 'id' of undefined
at xt._updateMarker (17.b21c1c3aa624cb080a0e.js:1)
at xt.addMarker (17.b21c1c3aa624cb080a0e.js:1)
at e.highlightTask (17.b21c1c3aa624cb080a0e.js:1)
at 17.b21c1c3aa624cb080a0e.js:1
at 17.b21c1c3aa624cb080a0e.js:1
at 17.b21c1c3aa624cb080a0e.js:1
at lm.yo.open (17.b21c1c3aa624cb080a0e.js:1)
at 17.b21c1c3aa624cb080a0e.js:1
at 17.b21c1c3aa624cb080a0e.js:1
at t.invokeTask (polyfills.1961ce0e8b846947432d.js:1)
Mh @ main.b4182912367c0c2773c0.js:1
(i=this._elementRegistry._elements[e.id])
this is my component
import {Component, ElementRef, OnInit, Renderer2, ViewChild} from '@angular/core';
import {Viewer} from './bpmn-js/bpmn-js';
import {CartableService} from '../cartable.service';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-modeler-viewer',
templateUrl: './viewer.component.html'
})
export class ViewerComponent implements OnInit {
public viewer;
public processKey;
public processName;
public taskKey;
@ViewChild('container', {read: ElementRef}) container: ElementRef;
constructor(private renderer: Renderer2,
private cartableService: CartableService,
private route: ActivatedRoute) {
this.route.queryParams.subscribe(params => {
this.processKey = params['processKey'];
this.processName = params['processName'];
this.taskKey = params['taskKey'];
this.load();
});
}
ngOnInit(): void {
this.initViewer();
}
private initViewer() {
this.viewer = new Viewer({
container: '#canvas',
width: '100%',
height: '600px',
noSketch: false,
});
}
load(): void {
this.cartableService.getProcessDefinitionXml(this.processKey).subscribe(
(response: any) => {
this.renderer.removeClass(this.container.nativeElement, 'with-error');
this.renderer.addClass(this.container.nativeElement, 'with-diagram');
this.viewer.importXML(response.bpmn20Xml, () => {
this.highlightTask();
});
},
error => {
this.renderer.removeClass(this.container.nativeElement, 'with-diagram');
this.renderer.addClass(this.container.nativeElement, 'with-error');
this.container.nativeElement.querySelector('.error pre').text(error.message);
}
);
}
private highlightTask() {
const canvas = this.viewer.get('canvas');
canvas.zoom('fit-viewport');
canvas.addMarker(this.taskKey, 'highlight');
}
}