cytoscape: Uncaught TypeError: Cannot assign to read only property 'unique' of object '[object Object]'

I was trying to use cytoscape in my Angular application, but i encountered this error during runtime

cytoscape.cjs.js:12624 Uncaught TypeError: Cannot assign to read only property 'unique' of object '[object Object]' 
    at Object../node_modules/cytoscape/dist/cytoscape.cjs.js (cytoscape.cjs.js:12624)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/shared/components/process-document-viewer/graph-viewer/graph-viewer.component.ts (main.js:145054)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/shared/components/process-document-viewer/process-document-viewer.module.ts (process-document-viewer.component.ts:13)
    at __webpack_require__ (bootstrap:79)

I used these steps to use cytoscape

  1. npm install cytoscape
  2. npm install --save @types/cytoscape
  3. added import * as cytoscape from 'cytoscape'; in my component.

Version of Angular is 8 Version of Cytoscape.js is 3.18.2