When running with Webpack, we need certain variables and classes in the window/global scope.


You can use the below reference snippet to load Skylink in a Webpack environment

Assuming Skylink has been installed as an NPM module, this should install AdapterJS and Socket-IO as peer dependencies.


const Skylink = require('skylinkjs').Skylink;
const AdapterJS = require('adapterjs'); // Peer dependency of SkylinkJS - should already be installed when npm i skylinkjs --save is run 
const io = require('socket.io-client'); // Peer dependency of SkylinkJS - should already be installed when npm i skylinkjs --save is run

window.Skylink = Skylink;
window.AdapterJS = AdapterJS;
window.io = io;

const skylink = new Skylink(...)