I have this situation where I am trying to import an existing library, which I\'ll call troublesome
(using Webpack/Babel FWIW) and it has a global reference to
For es6/2015 I done the following.
import {jsdom} from 'jsdom';
import jQuery from 'jquery';
var window = jsdom(undefined, {}).defaultView;
var $ = jQuery(window);
//window.jQuery = $; //probably not needed but it's there if something wrong
//window.$ = $;//probably not needed but it's there if something wrong
Then you can use it as normal
var text = $('').text('hello world!!!').text();
console.log(text);
Hope this helps.