"Window is undefined" simply by importing pixi.js v4.0.3 #3224
First of all I know default import isn't defined in 4.1, so I'm using 4.0.3, until that is fixed.
Simply having a file with nothing but "import PIXI from 'pixi.js'" causes a webgl error calling window:
I'm not even certain what pixify is... but this only happens when I import pixi.js. [Not it's an isomorphic web app, which simply won't render if typeof window is undefined.]
EDIT: I remapped to the non-minified version and got this instead:
EDIT: It looks like a lot of code needs to be wrapped...
The text was updated successfully, but these errors were encountered:
If this is isomorphic, then you are loading the code in
Often you need to polyfill/wrap a lot of the code to get it to work in node. If you could avoid loading pixi at all in node, that would be ideal.
To your first comment:
Importing pixi as a default import is incorrect, please use the
In case any other unlucky person comes across this issue, this is how I got around it:
This uses the
In es2015, imports are declared statically, so you can't disable the import in an isomorphic app without falling back to the old
Of course, this doesn't mean you can use
It's entirely understandable that the devs haven't focused on fixing this as it's a pretty narrow use case