perf(app): use @vitejs/plugin-rsc/rsc/* entries#2677
Conversation
Co-authored-by: OpenCode <noreply@opencode.ai>
| } from "@vitejs/plugin-rsc/rsc/server"; | ||
| import { prerender as _prerender } from "@vitejs/plugin-rsc/rsc/static"; |
There was a problem hiding this comment.
hasServerActions ? "@vitejs/plugin-rsc/rsc" : "@vitejs/plugin-rsc/react/rsc"This hasServerActions branch is introduced by #2206, but this shouldn't matter since tree shaking server action API is mostly done by the import branch above:
vinext/packages/vinext/src/entries/app-rsc-entry.ts
Lines 281 to 291 in f91363f
So this has been consolidated to just /rsc/server import unconditionally.
| "@mdx-js/rollup": "^3.0.0", | ||
| "@vitejs/plugin-react": "^5.1.4 || ^6.0.0", | ||
| "@vitejs/plugin-rsc": "^0.5.26", | ||
| "@vitejs/plugin-rsc": "^0.5.29", |
There was a problem hiding this comment.
I'm not sure if peer dep bump should be breaking change. From the past commit history, there doesn't seem to be strict policy.
There was a problem hiding this comment.
The other times i've switched to new Vite related functionality, i've left the old behaviour behind a version check to avoid breaking changes. Will probably have to see if the same thing can be done for this too. I can have a look at that no worries
@vitejs/plugin-rsc runtime entries@vitejs/plugin-rsc/rsc/* entries
|
@james-elicx BOOOOOM! PPR time baby |
commit: |
Performance benchmarksCompared 1 improved · 0 regressed · 5 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
| const [server, client] = await Promise.all([ | ||
| import("@vitejs/plugin-rsc/rsc/server"), | ||
| import("@vitejs/plugin-rsc/rsc/client"), | ||
| ]); |
There was a problem hiding this comment.
It looks like using /rsc/* here breaks for pages router setup because no rsc plugin means no virtual module used by /rsc/* entry.
I think ideally page router only mode can entirely nullifying packages/vinext/src/shims/cache-runtime.ts (and other related app router only modules). Let me check a bit.
There was a problem hiding this comment.
Attempting to remove "cache-runtime" import from pages router ssr entry 95d9862. The existing test appears to be asserting internal request context, which has no user facing pages router feature, so it's adjusted accordingly.
Co-authored-by: OpenCode <noreply@opencode.ai>
This PR updates the
@vitejs/plugin-rscruntime entries consumed by vinext.Vinext previously imported internal-ish
/core/*,/react/*, and/vendor/*entries. These are now replaced and consolidated to public/rsc/*runtime API family.Specifically:
/rsc/static, released in@vitejs/plugin-rsc@0.5.29, instead of deep import of/vendor/static API./rsc/serverentry for the main RSC runtime because it only consumes server-side APIs./rsc/serverand/rsc/clientseparately for the"use cache"runtime.The server/client split entries are a part of perf works by @TheAlexLichter (Thank you!). The background context is found in #2080 and vitejs/vite-plugin-react#1252.
The public static API was added in vitejs/vite-plugin-react#1285 with minimal example to exercise the PPR concept.
This is not by no means against Vinext using non-public API forever, but I think, from time to time, it's good to catch up with what API Vinext uses and make
@vitejs/plugin-rscalign the runtime API to prove some features are framework agnostic concept. If there's a future occasion to reach for core/vendor API, please feel free to do so 😃For perf number, the agent ran
benchmarks/perf/run-scenarios.mjsscript locally and claimed a following (I don't yet understand what the script does):Ran six alternating base/head rounds against
mainusing the generated 33-route benchmark app with framework caches cleared before each round.mainThe PR was faster in all six cold-start rounds. Production build time was noisy and showed no meaningful change. These are local macOS results; the PR performance workflow will provide the authoritative Linux CI comparison.