When compiling an Angular 7.2.5 application with --prod
, a strange run-time error occurs.
The stack trace shows:
ERROR TypeError: this._createContainer is not a function
at bg.pa (Viewer.js.pre-build-optimizer.js:143)
at new bg (Modeler.js.pre-build-optimizer.js:129)
at Qg.ngOnInit (diagram.component.ts:105)
at core.js.pre-build-optimizer.js:28285
at core.js.pre-build-optimizer.js:29961
at Sr (core.js.pre-build-optimizer.js:29900)
at ao (core.js.pre-build-optimizer.js:30868)
at core.js.pre-build-optimizer.js:30811
at Object.updateDirectives (diagram-wrapper.component.html:1)
at Object.ro [as updateDirectives] (core.js.pre-build-optimizer.js:30799)
Surprisingly, the file Viewer.js.pre-build-optimizer.js
does contain the _createContainer
function as shown below:
export default function Viewer(options) {
options = assign({}, DEFAULT_OPTIONS, options);
this._moddle = this._createModdle(options); // works
this._container = this._createContainer(options); // <---
...
Viewer.prototype._createContainer = function(options) {
var container = domify('<div class="bjs-container"></div>');
assign(container.style, {
width: ensureUnit(options.width),
height: ensureUnit(options.height),
position: options.position
});
return container;
};
This library is not native to Angular but can be found at https://github.com/bpmn-io/bpmn-js
I am unsure of how to proceed with resolving this issue while still utilizing the build optimizer.
Here are a couple of screenshots for reference: