Open kamranayub opened 3 years ago
Should this issue be restructured to gracefully fail if no window
is present?
Well I think we'd still like a template or example, and then the other issue is failing gracefully with no window
This issue hasn't had any recent activity lately and is being marked as stale automatically.
This issue hasn't had any recent activity lately and is being marked as stale automatically.
Here's an example of using Excalibur with Next. Since Excalibur can only execute on the client, it needs to be loaded via
useEffect
and a dynamic import otherwise Next will attempt to run the module in SSR. Unfortunately, right now we don't check forwindow
existence so it bombs in SSR.https://codesandbox.io/s/next-excalibur-5b18x?file=/game/game.js
FYI, this is still an issue in 0.24.5 which is exacerbated by HMR: https://github.com/excaliburjs/Excalibur/issues/1431
Working around by clearing the element by tag name/query selector when effect runs.
Originally posted by @kamranayub in https://github.com/excaliburjs/Excalibur/discussions/1886#discussioncomment-1309321