Jump to content

Deployment issue ES6


charlie_says
 Share

Recommended Posts

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?

 

Link to comment
Share on other sites

<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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...