Closed kevzettler closed 3 years ago
@kevzettler yes it's for node, why are you using webpack for a node module?
you propably should be using just pixi.js if with webpack
@Prozi its not node. Its a webworker, which is browser environment.
so the webworker has window is undefined hmm can you provide me with minimal reproduction of the worker code and how you try to run it? minimal repo would be awesome and I'll try to help @kevzettler
@Prozi find a minimal repo at https://github.com/kevzettler/pixi-webpack-worker
It is using default pixi but you can easily npm install
pixi-shim and drop in.
@kevzettler thanks for quick reply
so I managed to clone and reproduce the bugs
then I did some tweaking of pixi-shim
and with version 2.3.1 it works:
import PIXI from 'pixi-shim';
self.addEventListener('message', (message) => {
const application = new PIXI.Application();
console.log({ application, message });
});
also npm i pixi-shim --save
good luck!
Closing considering it worked with 2.3.1
I'm trying to use this in a webpack 5 bundle for a webworker. I get an error that
window
is not defined frompixi-shim/polyfills/window.js
.I'm totally confused because I thought this module was meant for headless environments like Node why is it looking for a
window
?