Next.js Discord

Discord Forum

.next package rly big if not using vercel server. Some suggestions how flux cache?

Unanswered
Argentine ant posted this in #help-forum
Open in Discord
Avatar
Argentine antOP
I understand about cronjob with build, but something better? may be some configuration in nextConfig? thanks 🙂

10 Replies

Avatar
Argentine antOP
someone help?
Avatar
Dunker
can you explain a bit more
.next package rly big if not using vercel server ?
.next folder is big at other hosting providers, or sth different
Avatar
Argentine antOP
Yes, certainly! When I connected to my server, I noticed that the .next folder was around 2GB in size, and I suspect it could become even larger over time. I believe this size increase might be due to the revalidate fetch feature in my project, which is fetching data without utilizing a "flux" mechanism. When hosting on Vercel, this issue seems to be handled efficiently, but on my current server, it's a concern. Despite checking the Next.js configuration settings, I didn’t find any relevant options in next.config.js that could potentially address this issue. I'd appreciate any recommendations or insights on how to better manage caching and reduce the size of the .next folder, especially any configurations that might be helpful in next.config.js. Thank you!
Avatar
Dunker
1) which is your hosting server and type of it like VPS, shared etc
2) can you send me your repo link or package.json
3) what happens if you do these respectively: (at project root terminal)
rm -rf .next && rm -rf node_modules && rm -rf package-lock.json && npm cache clear --force && npm i
(Remove .next, node_modules, package-lock.json, clear npm cache and install all packages again)
Do these, build app and look back again to size of .next
Avatar
Argentine antOP
VPS
2) i cant, i use next build, and next start with .env.local set
3) its problem production not install or cache in node modules, problem in .next folder cache
Avatar
Risky did start the fire 🙃
for 3, oldcoder wants you to remove all existing cache to see if it is keeping more than necessary (and those folders can cache lots)
Avatar
Dunker
Can I see your full build logs
Yeah sometimes we re caching a lot before deploying and rebuilding many times