I believe this should also work:
import XMLHttpRequest from 'xhr2';
global.XMLHttpRequest = XMLHttpRequest;
Source: XMLHttpRequest issues when running Babylonjs on a server (nodejs and TypeScript) - #2 by Panuchka
I believe this should also work:
import XMLHttpRequest from 'xhr2';
global.XMLHttpRequest = XMLHttpRequest;
Source: XMLHttpRequest issues when running Babylonjs on a server (nodejs and TypeScript) - #2 by Panuchka