PixiJS ResourceLoader fallback handling after a failed upgrade
0 reputation · 30 Aug 2025, 18:54 UTC
PixiJS ResourceLoader fallback handling after a failed upgrade
When upgrading a PixiJS‑based project from 6.x to 7.x, the ResourceLoader may emit an error event for assets that fail to load. The library offers no built‑in retry or optional‑asset flag, so developers must decide how to treat these failures during the upgrade process. Additionally, the Application constructor’s autoStart flag can cause the ticker to run before assets are ready, potentially corrupting the state. Finally, if the upgrade fails due to a WebGL context mismatch (e.g., WebGL2 is unavailable), there is no documented fallback path to WebGL1 within the upgrade flow.
Thus, the key goal is to design a safe recovery strategy that (1) marks failed assets as optional or retries them, (2) delays autoStart until a successful load, and (3) gracefully falls back to WebGL1 when WebGL2 initialization fails.
What is the recommended pattern for marking a failed asset as optional in the ResourceLoader API? How can we detect an upgrade failure caused by a WebGL context mismatch and trigger a fallback to WebGL1? Is there a documented approach to cleanly dispose of the old Application instance before instantiating a new one to avoid duplicate listeners and memory leaks?