RSCs Use Function Requests with Next on Pages?!
I noticed my function invocations are being used up a lot. Is it because of my Next.js
.rsc
files?
I was working under the assumption that the server components are being statically generated and simply served to the client as .html
, .css
and .js
, but it turns out they are causing server requests?
Is there any way I can opt to statically render these server components? I don't even use the features of server components like data fetching. They simply render HTML and compose Client Components.
Any tips and corrections on my line of thinking are greatly appreciated.4 Replies
Next is kind of heavy-handed in how Functions are invoked. IIRC you can only disable functions for explicitly exported CSS and JS. Everything else has to go through Functions or the router can break
dang... I guess I just chose the wrong stack to deploy on Cloudflare Pages D:
How's Astro with React Components like in comparison?
also yup, the
_next/static
already stops the exported CSS and JSS to execute as a function afaik. the only optimizations I was able to do was to make a _routes.json
file for some static assets that weren't being ignored already - like favicons and SEO stuff
it's kinda crazy how the next-on-pages
adapter doesn't do this automatically. i was really shockedNot entirely sure on that front, I don’t use React. As for why #next-on-pages doesn’t do it automatically, iirc it is because of Next’s routing rules thing
I see.. well, thanks for your input @HardlyWorkin'. it really helped clear it up for me