Skip to content

fix(nextjs): fix static exports - #8439

Merged
avivkeller merged 8 commits into
mainfrom
fix-static-exports
Dec 22, 2025
Merged

fix(nextjs): fix static exports#8439
avivkeller merged 8 commits into
mainfrom
fix-static-exports

Conversation

@avivkeller

Copy link
Copy Markdown
Member

As discussed on Slack, this PR fixes static exports by reworking use cache and use server files.

CopilotAI review requested due to automatic review settings December 21, 2025 23:34
@avivkeller
avivkeller requested review from a team as code ownersDecember 21, 2025 23:34
@vercel

vercelBot commented Dec 21, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentReviewUpdated (UTC)
nodejs-orgReadyReadyPreviewDec 22, 2025 7:55pm

@github-actions

Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website @nodejs/web-infra

Please review the changes when you have a chance. Thank you! 🙏

Comment threadapps/site/next-env.d.ts
@codecov

codecovBot commented Dec 21, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.66%. Comparing base (411449c) to head (0be3d61).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@ Coverage Diff @@## main #8439 +/- ##
==========================================
+ Coverage 73.59% 73.66% +0.06% 
==========================================
Files 108 108 Lines 9193 9193 Branches 313 312 -1 ==========================================
+ Hits 6766 6772 +6 + Misses 2425 2419 -6 
Partials 2 2 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bjohansebasbjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the CI workflow to use the deploy command, please

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Next.js static exports by replacing the experimental use cache directive with React's cache() function and removing unnecessary use server directives. The changes enable proper static site generation by moving data generation to module initialization time rather than runtime.

Key changes:

  • Removed experimental useCache: true flag from Next.js configuration
  • Converted provider files to use React's cache() function with top-level await for data generation
  • Removed use server directives and updated components to call synchronous cached provider functions

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
apps/site/next.config.mjsRemoved experimental useCache flag
apps/site/next-env.d.tsUpdated types reference path for development environment
apps/site/next-data/providers/vulnerabilities.tsConverted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/supportersData.tsConverted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/releaseVersions.tsConverted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/releaseData.tsConverted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/downloadSnippets.tsConverted from use cache directive to React cache() with top-level data generation
apps/site/layouts/Download.tsxRemoved await from provider call
apps/site/components/withSupporters.tsxRemoved use server directive and async/await from component
apps/site/components/withReleaseSelect.tsxRemoved use server directive and await from provider call
apps/site/components/withNodeRelease.tsxRemoved use server directive and async/await from component
apps/site/components/withDownloadSection.tsxRemoved await from provider calls
apps/site/components/withDownloadArchive.tsxRemoved async/await from component and provider call
apps/site/components/Releases/PreviousReleasesTable/index.tsxRemoved await from provider call
apps/site/components/EOL/EOLReleaseTable/index.tsxRemoved await from provider calls
apps/site/app/[locale]/not-found.tsxRemoved use server directive
apps/site/app/[locale]/download/archive/[version]/page.tsxRemoved async/await from generateStaticParams and provider calls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadapps/site/next-data/providers/releaseVersions.ts Outdated
Comment threadapps/site/next-data/providers/releaseVersions.ts Outdated
Comment threadapps/site/components/withNodeRelease.tsx
Comment threadapps/site/components/withReleaseSelect.tsx
Comment threadapps/site/layouts/Download.tsx
@MattIPv4

Copy link
Copy Markdown
Member

Can we make sure the PR CI is also updated to do a static build?

@github-actions

github-actionsBot commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

MetricValue
Old Total Size4.34 MB
New Total Size4.41 MB
Delta66.82 KB (+1.50%)

Changes

➕ Added Assets (9)
NameSize
.next/static/chunks/d30c92f7fd1a5413.js64.90 KB
.next/static/chunks/f0490e2735cff758.js204.26 KB
.next/static/chunks/5e2875a3694096bc.js27.74 KB
.next/static/chunks/cd7a9c7e77c6d4f1.js134.63 KB
.next/static/chunks/83746613e033c5eb.js27.28 KB
.next/static/chunks/440c65068d6fbae2.js27.74 KB
.next/static/chunks/c7363092071b3daf.js767.74 KB
.next/static/chunks/11128c08875d4595.js27.74 KB
.next/static/chunks/eb4fdb24df4a0411.js767.74 KB
➖ Removed Assets (9)
NameSize
.next/static/chunks/57342e625049ddc4.js64.80 KB
.next/static/chunks/f9d10990b7677271.js8.27 KB
.next/static/chunks/9291518bee3bf771.js61.69 KB
.next/static/chunks/5e18e9d3162bd477.js204.26 KB
.next/static/chunks/fc4ebb7566380f8c.js1.59 KB
.next/static/chunks/40481e1be1d4ab40.js31.98 KB
.next/static/chunks/f861a43df79a9d1a.js789.19 KB
.next/static/chunks/a966f28e2035f6d8.js31.98 KB
.next/static/chunks/616628337ae9b55e.js789.19 KB

Comment threadapps/site/app/[locale]/download/archive/[version]/page.tsx Outdated
Comment threadapps/site/next-data/providers/vulnerabilities.ts
Comment threadapps/site/next-data/providers/vulnerabilities.ts Outdated
Comment thread.github/workflows/build.yml
Comment thread.github/workflows/build.yml Outdated
Co-authored-by: Claudio Wunder <cwunder@gnome.org>
Signed-off-by: Aviv Keller <me@aviv.sh>

@ovflowdovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! Can you just double check at the very least these cache() inner functions are being executed once per build-worker instead of once per every page generated? 🤔 (The difference is having 4-8 console logs instead of 2K+)

@avivkeller

Copy link
Copy Markdown
MemberAuthor

Yes, it's only being run once per build worker. Only saw a couple of logs on the static build, not for every page

@ovflowd

Copy link
Copy Markdown
Member

Yes, it's only being run once per build worker. Only saw a couple of logs on the static build, not for every page

That's already a much better outcome, because the top-level await would be executed for every frigging page if I recall correctly. Okay, let's fast-track this PR, cc @nodejs/web-infra

Comment threadapps/site/components/withNodeRelease.tsx
@ovflowd
ovflowd marked this pull request as draft December 22, 2025 19:17
@avivkeller
avivkeller marked this pull request as ready for review December 22, 2025 19:51
@avivkeller
avivkeller added this pull request to the merge queueDec 22, 2025
Merged via the queue into main with commit f59b46cDec 22, 2025
12 checks passed
@avivkeller
avivkeller deleted the fix-static-exports branch December 22, 2025 20:09
@avivkelleravivkeller mentioned this pull request Dec 22, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@avivkeller@MattIPv4@ovflowd@bjohansebas