JSDOM is not a constructor
See original GitHub issueBasic info:
- Node.js version: 10
- jsdom version: 13.0.0
Minimal reproduction case
const { JSDOM } = require("jsdom");
const dom = new JSDOM(html);
I have this warning:
`
index.js?bed3:153 ./node_modules/jsdom/lib/jsdom/utils.js
216:21-40 Critical dependency: the request of a dependency is an expression
@ ./node_modules/jsdom/lib/jsdom/utils.js
@ ./node_modules/jsdom/lib/jsdom.js
@ ./src/components/IStore.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
`
I am not sure how to fix it, it's doesn't show me what dependency i need to update or install.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
TypeError: require(...).jsdom is not a function - Stack Overflow
Try using the following, var jsdom = require('jsdom'); const { JSDOM } = jsdom; const { document } = (new JSDOM('')).window; global.document ...
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 >How to make PDF from HTML - General - Node-RED Forum
Unfortunately I get TypeError: JSDOM is not a constructor. with the following flow: [ { "id": "ee71cb46e6084549", "type": "template", ...
Read more >jsdom | Best of JS
The JSDOM constructor accepts a second parameter which can be used to customize your jsdom in the following ways. Simple options. const dom...
Read more >JSDOM: How to Get Started - Testim.io
Using JSDOM is very simple. JSDOM expects that you pass some valid HTML to its constructor. Then, it'll parse that HTML just like...
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 Free
Top 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
After the debug, following code can be normal to use jsdom 🤩
However, I still can’t imagine why the basic usage of jsdom is not work 🤷♂️
I’ve ended up using http://pdfmake.org/
It works just fine, but you have to parse everything into the expected format thoug.
Plus be aware: is Heavy as hell!