Dmnjs is not a constructor

Hi,
I am using dmn-js from 2 years with angular project and recently I’ve updated my project to angular 8 and dmn-js to 6.3.3 (previously v0.9.0) and diagram-js to 3.3.1(previously v0.18.4). In this new upgrade I am getting an error telling that dmn is not a constructor.

import * as dmnJs from ‘dmn-js’;

const dmn = require(‘dmn-js/lib/Modeler’);

private viewer: any;
private dmnContainer = null;

showDmn(dmnName): void {
this.programService.getSystemLevelRules(dmnName).then((res: any) => {

  if (this.dmnContainer) {
    document.getElementsByClassName('dmn-diagram')[0].remove();
  }

  this.dmnContainer = document.getElementsByClassName('canvas')[0];

  this.viewer = new dmn({container: this.dmnContainer});

  this.viewer.importXML(res, function(err) {
    if (!err) {
      console.log('success!');
    } else {
      console.log('something went wrong:', err);
    }
  });
});

}

Error: Uncaught (in promise): TypeError: dmn is not a constructor
TypeError: dmn is not a constructor

Can someone help me with what changes I have to make to make this one work.

Thanks!

I am not sure why you import dmn-js twice. Have you tried simple

import DmnModeler from 'dmn-js/lib/Modeler';

// code

const modeler = new DmnModeler({container: this.dmnContainer});

?