New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: 'Worker is not defined' with Pixi 7.4.0 and Node v18.17.1 #10170
Comments
|
Thanks @bigtimebuddy , and sorry for the noise.. |
We shouldn't be star importing from Pixi in our `util` module, this is code that should be expected to be run headlessly in unit tests. re: pixijs/pixijs#10170
No worries! |
I still have this problem in a Tauri app with NextJS (everything is configured to be client-side). Everything worked on pixi.js 7.3.3, but after updating to 7.4.0 it still works correctly, but I get an error node_modules\.pnpm\@pixi+assets@7.4.0_@pixi+core@7.4.0\node_modules\@pixi\assets\lib\_virtual\checkImageBitmap.worker.mjs (20:29) @ Worker
⨯ ReferenceError: Worker is not defined
at __webpack_require__ (C:\Users\niar-windows\Documents\repos\bioparallel\.next\server\webpack-runtime.js:33:42) Also the project can't be build, because Worker is not defined, and even though everything is configured to be on the client-side it still seems to check if everything functions on SSR or something EDIT: const Dashboard = dynamic(
() =>
import("@/components/tabs/dashboard/dashboard").then(
mod => mod.Dashboard
),
{ ssr: false }
); And now it seems to work without errors. So it's not a pixi problem |
I seem to be getting this exact issue on Electron, running on the Main (node) process, and I'm using the node package. Seems like some juggling around worker files might have introduced this issue? pixijs/node#15 Edit: my thinking is after the PR below the worker code is imported where before during the build now, where before it was encoded as string and loaded as-needed. The pixi/node seems to work by letting pixi load whatever extensions it needs and then unloading those that aren't compatible with node. Problem is that the code is not eliminated and the class is created up-front, not on-demand so the loader adds a class that tries to extend Worker class that doesn't exist in node, and the code is run, even though it would get unloaded later in the node package. |
PR that affected Workers is here #9399 |
I apologize for not considering Node.JS environment in that PR! I'll fix this issue soon. |
@SuperSodaSea Thank you! |
I wonder if we can keep the external worker.ts files (and all the type checking and linting benefits of that), but import and inline the code as a string. So we aren't shipping external worker files. |
@bigtimebuddy Not sure if it's a side effect of manually patching Worker to see if I could get around the issue, but I started getting similar errors about |
@notchris can you call out those document issues? Sure we can get that sorted too. |
@bigtimebuddy Sure thing - it's actually not document, that was my mistake. The issue comes from extract method on
|
@notchris |
Currently the worker code is already inlined as a string (see |
I'm referencing the official example: https://github.com/pixijs/node, but that's good to know. Should that be updated as well? I'm going to try out .pixels now! |
Current Behavior
We have a test suite using Node Test Runner and running with Node v18.17.1 and after installing the latest v7.4.0 Pixi release our tests are throwing a new error:
I'm not sure whether we need to switch to a different build of Pixi for node. (I also might be able to work around the issue another way, since we aren't using the worker functionality here.)
Expected Behavior
No errors.
Steps to Reproduce
tbd
Environment
pixi.js
version: e.g. 7.4.0Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: