Skip to content

Conversation

@avivkeller
Copy link
Member

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

Copilot AI review requested due to automatic review settings December 21, 2025 23:34
@avivkeller avivkeller requested review from a team as code owners December 21, 2025 23:34
@vercel
Copy link

vercel bot commented Dec 21, 2025

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

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 22, 2025 7:55pm

@github-actions
Copy link
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! 🙏

@codecov
Copy link

codecov bot commented Dec 21, 2025

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.

Copy link
Member

@bjohansebas bjohansebas left a comment

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

Copy link
Contributor

Copilot AI left a comment

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
File Description
apps/site/next.config.mjs Removed experimental useCache flag
apps/site/next-env.d.ts Updated types reference path for development environment
apps/site/next-data/providers/vulnerabilities.ts Converted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/supportersData.ts Converted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/releaseVersions.ts Converted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/releaseData.ts Converted from use cache directive to React cache() with top-level data generation
apps/site/next-data/providers/downloadSnippets.ts Converted from use cache directive to React cache() with top-level data generation
apps/site/layouts/Download.tsx Removed await from provider call
apps/site/components/withSupporters.tsx Removed use server directive and async/await from component
apps/site/components/withReleaseSelect.tsx Removed use server directive and await from provider call
apps/site/components/withNodeRelease.tsx Removed use server directive and async/await from component
apps/site/components/withDownloadSection.tsx Removed await from provider calls
apps/site/components/withDownloadArchive.tsx Removed async/await from component and provider call
apps/site/components/Releases/PreviousReleasesTable/index.tsx Removed await from provider call
apps/site/components/EOL/EOLReleaseTable/index.tsx Removed await from provider calls
apps/site/app/[locale]/not-found.tsx Removed use server directive
apps/site/app/[locale]/download/archive/[version]/page.tsx Removed async/await from generateStaticParams and provider calls

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

@MattIPv4
Copy link
Member

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 21, 2025

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 4.34 MB
New Total Size 4.41 MB
Delta 66.82 KB (+1.50%)

Changes

➕ Added Assets (9)
Name Size
.next/static/chunks/d30c92f7fd1a5413.js 64.90 KB
.next/static/chunks/f0490e2735cff758.js 204.26 KB
.next/static/chunks/5e2875a3694096bc.js 27.74 KB
.next/static/chunks/cd7a9c7e77c6d4f1.js 134.63 KB
.next/static/chunks/83746613e033c5eb.js 27.28 KB
.next/static/chunks/440c65068d6fbae2.js 27.74 KB
.next/static/chunks/c7363092071b3daf.js 767.74 KB
.next/static/chunks/11128c08875d4595.js 27.74 KB
.next/static/chunks/eb4fdb24df4a0411.js 767.74 KB
➖ Removed Assets (9)
Name Size
.next/static/chunks/57342e625049ddc4.js 64.80 KB
.next/static/chunks/f9d10990b7677271.js 8.27 KB
.next/static/chunks/9291518bee3bf771.js 61.69 KB
.next/static/chunks/5e18e9d3162bd477.js 204.26 KB
.next/static/chunks/fc4ebb7566380f8c.js 1.59 KB
.next/static/chunks/40481e1be1d4ab40.js 31.98 KB
.next/static/chunks/f861a43df79a9d1a.js 789.19 KB
.next/static/chunks/a966f28e2035f6d8.js 31.98 KB
.next/static/chunks/616628337ae9b55e.js 789.19 KB

Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
Copy link
Member

@ovflowd ovflowd left a comment

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
Member Author

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
Member

ovflowd commented Dec 22, 2025

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

@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 queue Dec 22, 2025
Merged via the queue into main with commit f59b46c Dec 22, 2025
12 checks passed
@avivkeller avivkeller deleted the fix-static-exports branch December 22, 2025 20:09
Sign up for free to 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