Sign In Register

How can we help you today?

Start a new topic

Javascript SDK - assignment to undeclared variable GameSparks

Using ReactJS with webpack... At runtime, the top line in gamesparks.js:

 

GameSparks = function() {

 is throwing a "ReferenceError: assignment to undeclared variable GameSparks".


Am I supposed to be adding something to webpack.config.js?


fyi, changing that line to:

 

function GameSparks() {

 gets the program to here:

 

var gamesparks = new GameSparks();

 and then it throws "TypeError: GameSparks is not a constructor". 

well i got it to work by linking the gamesparks libs from my index.html, instead of trying to bundle it with the rest of the javascript ... still confused tho, heh!

Have there been any updates to the JavaScript SDK since this original post? I'm using Webpack, too, and not sure how to require() the SDK files in that context instead of as script tags in an html file.


This process is pretty standard for a modern HTML5 project, so it would be great for GameSparks to support it officially.

Also, I get these warnings. Maybe the js SDK is using deprecated calls? I'm using ws version 3.2.0.


WARNING in ./node_modules/ws/lib/BufferUtil.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/lootdrop/Documents/Projects/drone-delivery/node_modules/ws/lib'

WARNING in ./node_modules/ws/lib/Validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/lootdrop/Documents/Projects/drone-delivery/node_modules/ws/lib'

 

Login to post a comment