charlie_says Posted February 2, 2018 Share Posted February 2, 2018 I've got an odd issue with the deployment of a PIXI project. I'm creating an ES6 JS file - when I view it through localhost, or push it up to my site, it works fine. But, when I deploy through the end client system, the game fails. This is obviously something to do with their bundling, but I just cannot work around it. I get the error 'PIXI is not defined at...' which it appears it should be, as the PIXI.min.js has been added into the bundled JS file above the game code. I think this is caused by PIXI being a global variable, but I've not been able to get it to work. Anyone got any ideas? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 2, 2018 Share Posted February 2, 2018 "PIXI.min.js" you sure the name is caps? Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 2, 2018 Author Share Posted February 2, 2018 ah, if only it was that easy - it is pulling in pixi.min.js correctly I just got a bit caps happy. Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 2, 2018 Author Share Posted February 2, 2018 I wondered if it was something to do with using ///<reference in TS rather than importing PIXI in... Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 2, 2018 Share Posted February 2, 2018 <reference> in TS does not affect runtime. We have sample file for TS: https://github.com/pixijs/pixi-spine/blob/master/test/checkpack.ts Ignore "//@.." part, that's for testing vanilla approach (no import/export) I'm afraid you have to post an example in zip file. There are people here and in pixijs slack who know about problems with import/export, but I'm afraid general advices wont help you anymore. Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 2, 2018 Author Share Posted February 2, 2018 thanks @ivan.popelyshev I'll see what the client can give me - and then pop into the pixi slack next week Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 4, 2018 Author Share Posted February 4, 2018 I actually came back to this a different way - I stopped using TS and recoded enough of the game in vanilla ES6 to try that out... My really vanilla test worked! But then I started adding in more game elements. And, the ES6 version fails in exactly the same place. Essentially, it's when I extend a PIXI class. When I load the game JS in, it doesn't recognise PIXI (i.e. class Button extends PIXI.Container ), any further ideas would be great! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 5, 2018 Share Posted February 5, 2018 Yeah, the problem is known and solved many times. Use search in our github issues. Quote Link to comment Share on other sites More sharing options...
botmaster Posted February 7, 2018 Share Posted February 7, 2018 It's just a race condition, before the instance of your app gets created you need a code that makes sure PIXI is ready to go. I ran into that kind of problem bunch of times before until I had enough of it and wrote some code that would only create my main app instance until it's sure the PIXI global is there to work with. The magical thing about it is that it takes care of all race condition scenario possible in every single browser so that's a win win. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.