Skip to content

Pin playcanvas to ~2.19.7 to fix broken build#1074

Merged
willeastcott merged 1 commit into
mainfrom
fix/pin-playcanvas-2.19
Jul 1, 2026
Merged

Pin playcanvas to ~2.19.7 to fix broken build#1074
willeastcott merged 1 commit into
mainfrom
fix/pin-playcanvas-2.19

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

What changed

Pins playcanvas to ~2.19.7 in package.json (with the matching package-lock.json update), reverting the bump to 2.20.4 from f6039fa.

Why

npm run build has been failing on main since the dependency update (CI and the GitHub Pages deploy are both red). Static site generation crashes on all 639 doc pages.

Root cause: engine 2.20.0 includes playcanvas/engine#8950, which moved updateClientRect() into the base GraphicsDevice constructor. That calls this.canvas.getBoundingClientRect(). @playcanvas/react creates a NullGraphicsDevice for SSR using a bare mock object ({ id: 'pc-react-mock-canvas' }) as the canvas — and does so at module scope — so merely importing @playcanvas/react during SSG throws getBoundingClientRect is not a function. The crash corrupts the shared doc-page chunk, which is why every page then fails with the misleading Cannot read properties of undefined (reading 'A') error.

Notes for reviewers

  • The pin uses a tilde range on purpose: ^2.19.7 would immediately re-resolve to 2.20.4 and break again.
  • This is a stopgap. The real fixes are upstream: guard the constructor-time getBoundingClientRect() call in the engine, and/or give @playcanvas/react's SSR mock canvas a getBoundingClientRect stub (and make its module-scope null application lazy). Once either ships, this pin can be relaxed back to ^2.20.x.
  • Verified locally: full npm run build (en + ja) passes with 2.19.7 and fails with 2.20.0 through 2.20.4.

🤖 Generated with Claude Code

Engine 2.20.0 (playcanvas/engine#8950) moved updateClientRect() into the
base GraphicsDevice constructor, which calls canvas.getBoundingClientRect().
@playcanvas/react constructs a NullGraphicsDevice with a bare mock canvas
object at module scope for SSR, so importing it during Docusaurus static
site generation now throws, failing all 639 doc pages. Pin the engine to
2.19.x (tilde range, since a caret would re-resolve to 2.20.x) until the
upstream fixes land.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@willeastcott willeastcott merged commit 3cd5fe2 into main Jul 1, 2026
3 checks passed
@willeastcott willeastcott deleted the fix/pin-playcanvas-2.19 branch July 1, 2026 22:16
willeastcott added a commit that referenced this pull request Jul 2, 2026
Engine 2.20.5 fixes the NullGraphicsDevice constructor crash on mock
canvases (playcanvas/engine#8999) that broke static site generation,
so the ~2.19.7 pin from #1074 is no longer needed.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant