Heap is not a constructor
See original GitHub issueIssue type
Bug report
Environment info
- Cytoscape.js version : 3.2.1
- Browser/Node.js & version : 8.4.0
- webpack: 3.5.5
Current (buggy) behaviour
error: Heap is not a constructor
probably Webpack can’t load the heap
package.
Relevant tsconfig.json
"compilerOptions": {
"noUnusedParameters": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"noEmit": true,
"target": "es2015",
"module": "commonjs",
"noImplicitAny": false,
"sourceMap": true,
"inlineSourceMap": false,
"inlineSources": false,
"preserveConstEnums": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"jsx": "preserve",
"lib": [
"dom",
"es5",
"es6",
"es7",
"es2017.object"
],
"allowSyntheticDefaultImports": true
},
Works fine with v3.1.5
. Probably related to https://github.com/cytoscape/cytoscape.js/issues/1858
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
NodeJs heap-js module: Heap is not a constructor
I am trying to initialize a minimum heap/ ...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >A heap implemented as an array in C++. - CS 221
HeapItem.h // Simple class with which to build the heap demonstration. ... Dummy data value public: HeapItem(); // Default constructor HeapItem(int key, ...
Read more >Max heap ADT - MaxHeap.h - Linux Assembly
Max heap ADTMaxHeap.h ... Max heap is a specialized tree-based data structure that satisfies the heap property: either the keys of parent nodes...
Read more >Record heap snapshots using the Memory tool - Microsoft Learn
Summary view shows objects grouped by the constructor name. ... Not all properties are stored on the JavaScript heap.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I very much appreciate you putting extra effort to have this solved but for now I have made peace with using the bundled version 😃
While it sure seems to be an issue with my
tsconfig
(or may bewebpack
config), but I am unable to identify it. I tried various combination for compiler optiontarget
,module
&allowSyntheticDefaultImports
,allowJs
&isolatedModules
but none seems to be able to work. The importedHeap
variable seems to be an empty object,when editing the dist file asThe peer dependencies are working for all other of packages (almost all of them having react,d3 & lodash as one). I also have both
"@types/heap": "^0.2.28"
&"heap": "^0.2.6"
installed. Thanks to bundles version it’s not an issues for me asheap
is quite a small lib.Again thanks for your help.
For anyone else facing same issue with webpack & typescript, a workaround is to have the following in your webpack config.
Cytoscape is not a Typescript library. It’s a JS library. You have to configure your build properly to accommodate for that.
You have a problem with transitive dependencies. Check your typings. Check that you have typings for the npm dependencies of
cytoscape@3.2
.I recommend you read the docs carefully for your tooling:
It works for me with just a single line:
For reference:
And if we run the bundle, it works just fine: