I'm getting jQuery requires a window with a document
error and it seems that I need an answer like: Error: jQuery requires a window with a document
What I'm looking for is the correct syntax for this using import
rather than require
because I'm not require
-ing anything else in my Node app. I'm trying to get this to work in a React component. I tried:
import jsdom from 'jsdom';
import $ from 'jquery';
jsdom.jsdom().createWindow();
and:
import jsdom from 'jsdom';
const $ = require('jquery')(jsdom.jsdom().createWindow());
But that's not getting me there. How do I resolve this?