Problem
Several hot paths in vinext perform redundant work:
hasMdxFiles() recursively walks app/ and pages/ via fs.readdirSync() on every config() hook invocation (fires 3+ times per Vite environment: RSC/SSR/Client)
resolvePostcssStringPlugins() probes 17 PostCSS config file candidates with fs.existsSync() on every config() hook invocation, with no caching
- KV cache handler uses byte-by-byte
String.fromCharCode/charCodeAt loops for base64 encode/decode instead of Buffer APIs
- App Router prod server normalizes the request pathname, then discards it when constructing the Web Request — forcing the RSC handler to re-normalize
Solution
- Cache
hasMdxFiles() and resolvePostcssStringPlugins() results per root directory
- Replace manual base64 with
Buffer.from().toString("base64") / Buffer.from(str, "base64")
- Pass pre-normalized URL to
nodeToWebRequest() so the RSC handler hits the fast path
PR
#436