impr: React prerendering test app#2597
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (355 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.96, 2.11, 4.31, 6.79, 7.77, 12.36, 23.20, 23.32]
line [1.08, 2.19, 4.43, 6.76, 7.79, 12.32, 23.31, 25.81]
line [1.03, 2.03, 4.35, 6.73, 7.76, 10.65, 21.42, 21.19]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.35, 0.58, 0.75, 0.92, 1.27, 1.28, 1.57, 1.67]
line [0.34, 0.58, 0.73, 0.90, 1.25, 1.29, 1.58, 1.74]
line [0.36, 0.56, 0.70, 0.84, 1.25, 1.30, 1.55, 1.71]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.94, 2.15, 4.13, 6.49, 12.97, 26.82, 59.16, 121.14]
line [0.81, 2.19, 4.36, 6.64, 12.88, 26.92, 58.64, 119.15]
line [0.80, 2.07, 4.08, 6.38, 12.36, 25.73, 57.13, 118.27]
|
d3946ca to
dcad552
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a minimal Next.js app to reproduce/test @typegpu/react behavior during prerendering, and adjusts unplugin-typegpu’s Babel transform so hoisted "use gpu" function declarations preserve module exports.
Changes:
- Introduces
apps/react-prerendering-test(Next.js static-export app) with a shader demo and an SSR-vs-no-SSR build check script. - Updates
packages/unplugin-typegpu/src/babel.tsto rewriteexport function .../export default function ...correctly when hoisting transformed declarations. - Updates
unplugin-typegputests andpnpm-lock.yamlfor the new app and dependency graph.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds the new app importer and Next.js-related dependency resolutions. |
| packages/unplugin-typegpu/src/babel.ts | Updates Babel hoisting/export rewrite logic for "use gpu" function declarations. |
| packages/unplugin-typegpu/test/use-gpu-directive.test.ts | Splits export-hoisting coverage into Babel/Rollup and updates snapshots. |
| apps/react-prerendering-test/package.json | Defines the new app’s dependencies and SSR-check scripts. |
| apps/react-prerendering-test/tsconfig.json | Adds Next/TS configuration for the new test app. |
| apps/react-prerendering-test/next.config.ts | Configures static export output and build directory. |
| apps/react-prerendering-test/babel.config.js | Enables unplugin-typegpu Babel plugin under Next’s Babel pipeline. |
| apps/react-prerendering-test/checkSsr.mts | Adds a helper script to run builds with SSR enabled/disabled. |
| apps/react-prerendering-test/README.md | Documents the intent and how to run the SSR checks. |
| apps/react-prerendering-test/app/layout.tsx | Adds a minimal layout/metadata for the app-router setup. |
| apps/react-prerendering-test/app/page.tsx | Adds the page that toggles SSR behavior for the shader component. |
| apps/react-prerendering-test/components/Shader.tsx | Implements a client-only demo using @typegpu/react + TypeGPU functions. |
| apps/react-prerendering-test/app/icon.svg | Adds an app icon asset. |
| apps/react-prerendering-test/.gitignore | Ignores Next build artifacts for this app. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
85d38a6 to
2886554
Compare
iwoplaza
left a comment
There was a problem hiding this comment.
Thanks a lot! Left a few nits
Blocked by #2606.
before doing that, we must fix
@typegpu/reactso it doesn't throw on the server sideEDIT: my fault, didn't prefixed env variables with
NEXT_PUBLIC_