Skip to content

Conversation

@ovflowd
Copy link
Member

@ovflowd ovflowd commented Oct 11, 2025

This PR is a draft PR for upgrading to Next.js 16.

  • Development Server Works
  • Production Build fails
❯ pnpm build

> @node-core/website@ prebuild /home/cwunder/GitHub/nodejs.org/apps/site
> node --run build:blog-data


> @node-core/website@ build /home/cwunder/GitHub/nodejs.org/apps/site
> node --run build:default -- --turbopack

   ▲ Next.js 16.0.0-beta.0 (Turbopack)
   - Experiments (use with caution):
     ✓ globalNotFound
     · optimizePackageImports
     ✓ parallelServerBuildTraces
     ✓ parallelServerCompiles
     ✓ turbopackFileSystemCacheForDev
     ✓ webpackBuildWorker

   Creating an optimized production build ...
 ✓ Compiled successfully in 5.1s
   Skipping validation of types
 ✓ Collecting page data in 654ms    
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error [PageNotFoundError]: Cannot find module for page: /_document
    at ignore-listed frames {
  code: 'ENOENT'
}
Export encountered an error on /_error: /404, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null
 ELIFECYCLE  Command failed with exit code 1.

@vercel
Copy link

vercel bot commented Oct 11, 2025

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

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Nov 24, 2025 8:01pm

@codecov
Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.86%. Comparing base (f9b57d7) to head (bc076de).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8218      +/-   ##
==========================================
- Coverage   76.23%   74.86%   -1.38%     
==========================================
  Files         118      118              
  Lines        9903     9903              
  Branches      337      331       -6     
==========================================
- Hits         7550     7414     -136     
- Misses       2351     2487     +136     
  Partials        2        2              

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

@ovflowd
Copy link
Member Author

ovflowd commented Oct 12, 2025

cc @styfle any idea what the prod build failing could be? Pretty much using standard error pages 🤔

@icyJoseph
Copy link
Contributor

icyJoseph commented Oct 14, 2025

Hi, I haven't fully sorted this out, but I managed to get a "bad" passing build. This was my only attempt and the order of steps was a bit chaotic, so not as linearly as presented here.

I used the --debug-prerender flag on next build, and followed the trace from there.

With that flag I started to see:

Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
@node-core/website:build: Error: 
@node-core/website:build:     at WithNavBar (turbopack:///[project]/apps/site/components/withNavBar.tsx:43:31)
@node-core/website:build:   41 |   const { resolvedTheme, setTheme } = useTheme();
@node-core/website:build:   42 |   const { replace } = useRouter();
@node-core/website:build: > 43 |   const pathname = usePathname();
@node-core/website:build:      |                               ^

All of the errors reported, pointed at the group of next-intl helpers, Link, usePathname, useRouter from app/site/navigation.mjs - note that I am not claiming a bug on next-intl.

useLocale and useTranslations were also lifted by --debug-prerender.

After replacing the helpers with their original Next.js version, and replacing useLocale() with a string and useTranslations with a dummy function. I hit one more error, /pages somehow requiring _document to be present. To get around this, I renamed the folder pages to _pages and then edited next.dynamic.mjs file to read from _pages:

 const websitePages = await getMarkdownFiles(
    process.cwd(),
    `_pages/${defaultLocale.code}`
  );

With all of that...

Screenshot 2025-10-13 at 22 55 00

I think the path generation is somehow causing all of these to error. At this point, I do not think that we need to change pages to _pages necessarily. It is just a coincident I believe.

Also I am not familiar enough with this repo, so maybe I am building with the wrong .envs.

Note that https://github.com/amannn/next-intl/tree/main/examples/example-app-router w/ next@beta builds without errors too.

Hopefully this gives you some insight. Happy to keep on helping!

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I think the path generation is somehow causing all of these to error. At this point, I do not think that we need to change pages to _pages necessarily. It is just a coincident I believe.

Sounds like a bug on Next.js imo

All of the errors reported, pointed at the group of next-intl helpers, Link, usePathname, useRouter from app/site/navigation.mjs - note that I am not claiming a bug on next-intl.

Could be that next-intl needs to upgrade to be compatible with Next.js 16? cc @amannn

@icyJoseph
Copy link
Contributor

Most likely a Next.js thing yeah ~ I'll try to set some time apart later, to try and build by bisecting canaries.

@amannn
Copy link
Contributor

amannn commented Oct 14, 2025

Hey @ovflowd, thanks for pinging me! So yes, as @icyJoseph mentioned, the examples in the next-intl repo all worked flawlessly with the beta without modification. I'll only rename the middleware.ts files to proxy.ts in amannn/next-intl#2054.

The only change I found in Next.js 16 beta that broke something for me was related to parallel routes (see vercel/next.js#84738), but a potential solution was discussed in that thread.

I'll make a note to take a closer look at this PR tomorrow, maybe I can spot something! I'll keep you posted.

@icyJoseph
Copy link
Contributor

icyJoseph commented Oct 14, 2025

Hello again!

Could someone verify this, I've been doing some canary bisecting and such, and figured out a couple of things.

Building with --webpack, and removing global-not-found.tsx, passes the build. Right?

Building with --turbopack, removing global-not-found.tsx and mving pages to says _pages, passes the build (who knows what other things go wrong). Right?

Edit: I am confident I've found the source of the bug, I just don't understand global-not-found's role on it, just yet, aka, I can reproduce the bug locally but global-not-found is not part of that just yet.

@icyJoseph
Copy link
Contributor

@amannn sorry for the tag mate, but the mystery is nearly solved.

The global-not-found file on this PR, uses GlowingBackdrop, which in turn uses WithNavBar. The WithNavBar component invokes useSiteNavigation -> useTranslations from next-intl. I guess, it is expected to crash in this scenario? Given the component tree seen from global-not-found?

If we can sort this one out, then --webpack will builds, and we'll likely have a follow up patch to fix --turbopack.

@icyJoseph
Copy link
Contributor

icyJoseph commented Oct 14, 2025

Got the solution :)

global-not-found is missing <NextIntlClientProvider> - https://next-intl.dev/docs/environments/server-client-components#missing-context

Then --webpack builds will work. There's a bug when --turbopack attempts to not generate any Pages Router files (/_error, /500, etc), if it doesn't detect valid Pages Router pages, but this repo setup triggers a bad branch in the code. We are working on a patch for that.

@avivkeller
Copy link
Member

this repo setup triggers a bad branch in the code. We are working on a patch for that.

We are always happy to bug test dependencies 😃, betas are important!

Thank you!

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

Got the solution :)

global-not-found is missing <NextIntlClientProvider> - next-intl.dev/docs/environments/server-client-components#missing-context

Then --webpack builds will work. There's a bug when --turbopack attempts to not generate any Pages Router files (/_error, /500, etc), if it doesn't detect valid Pages Router pages, but this repo setup triggers a bad branch in the code. We are working on a patch for that.

Weird thing is Turbopack builds were working with Next.js 15 🤔

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I also found something interesting when creating a pages/404.tsx and a pages/500.tsx and deleting the ones from App Router, it gives this:

> Build error occurred
Error: Turbopack build failed with 1 errors:
./apps/site
App Router and Pages Router both match path: /_not-found
Next.js does not support having both App Router and Pages Router routes matching the same path. Please remove one of the conflicting routes.

Something is clearly bugged/borked on Next.js

@icyJoseph
Copy link
Contributor

Weird thing is Turbopack builds were working with Next.js 15

Right, in one of the canaries going up to v16, a Turbopack optimization was introduced, where some Pages Router assets are no longer generated, if there's no Pages Router code. How "no Pages Router code" is calculated has a bad branch.

Hopefully a patch will be out soon 🙏

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I was able to make it work with a very interesting work around. Creating a 404.tsx and 500.tsx, which kinda explains what you just said.

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Oct 14, 2025
@ovflowd ovflowd marked this pull request as ready for review October 14, 2025 23:16
@ovflowd ovflowd requested a review from a team as a code owner October 14, 2025 23:16
Copilot AI review requested due to automatic review settings October 14, 2025 23:16
@ovflowd ovflowd requested a review from a team as a code owner October 14, 2025 23:16
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Oct 14, 2025
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 upgrades the Next.js framework from version 15.5.4 to 16.0.0-beta.0, bringing support for React 19 and introducing the React Compiler. The upgrade includes configuration changes to support new features and fixes for build issues.

Key changes:

  • Upgraded Next.js to version 16.0.0-beta.0 with React Compiler enabled
  • Added placeholder error pages (404.tsx and 500.tsx) and updated error handling components
  • Migrated from Turbo to Turbopack for build optimization and updated TypeScript JSX configuration

Reviewed Changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Updated @types/react version for React 19 compatibility
package.json Updated cross-env and globals dependencies
apps/site/tsconfig.json Changed JSX transform and added dev types path
apps/site/pages/500.tsx Added placeholder 500 error page
apps/site/pages/404.tsx Added placeholder 404 error page
apps/site/package.json Upgraded Next.js and related packages, added React Compiler
apps/site/next.config.mjs Enabled React Compiler and Turbopack configurations
apps/site/mdx/plugins.mjs Optimized Shiki plugin as singleton for performance
apps/site/eslint.config.js Updated ESLint Next.js configuration format
apps/site/app/global-error.tsx Removed global error page component
apps/site/app/[locale]/not-found.tsx Converted to server component and simplified UI
apps/site/app/[locale]/error.tsx Simplified error page UI and removed arrow icon
.prettierignore Added next-env.d.ts to ignore list
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 97 🟠 88 🟢 100 🟢 100 🔗
/en/about 🟢 100 🟢 93 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 98 🟢 93 🟢 100 🟢 100 🔗
/en/download 🟢 99 🟢 96 🟢 100 🟢 100 🔗
/en/download/archive/current 🟢 100 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 98 🟢 100 🟢 96 🟢 100 🔗

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

(Although this is just a workaround and it also creates a /500 and /404 route that are empty pages LOL)

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Nov 24, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Nov 24, 2025
@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Nov 24, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Nov 24, 2025
@ovflowd
Copy link
Member Author

ovflowd commented Nov 24, 2025

has anyone messed with storybook here yet?

Checked. Storybook still working nicely :)

@github-actions
Copy link
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.51 MB
New Total Size 4.13 MB
Delta 626.91 KB (+17.42%)

Changes

➕ Added Assets (39)
Name Size
.next/static/chunks/6c2a3a5f9da86ecf.js 13.14 KB
.next/static/chunks/b32c3584cebbd41d.js 42.60 KB
.next/static/chunks/9871f931d7b09efc.js 83.73 KB
.next/static/chunks/53f377bc63a5e03d.js 209.84 KB
.next/static/chunks/b639062e4f32a900.js 46.12 KB
.next/static/chunks/2e128ae3fb83a5ab.js 283.00 B
.next/static/chunks/7630b61f71c0d406.js 27.30 KB
.next/static/chunks/33ce4b6fc3aa12bb.js 22.81 KB
.next/static/chunks/14707538f07dff24.js 64.74 KB
.next/static/chunks/eff0251723232c83.js 8.26 KB
.next/static/chunks/b1f809badca98ed5.js 61.69 KB
.next/static/chunks/968712cf7ec5fce3.js 99.69 KB
.next/static/chunks/79120b5d26d8ffbe.js 415.72 KB
.next/static/chunks/5a87fcaecbbd97ba.js 203.50 KB
.next/static/chunks/6825069e1f01b20c.js 11.85 KB
.next/static/chunks/b9ae97a0192791f5.js 10.25 KB
.next/static/chunks/4c4eee9c0a2a787d.js 13.61 KB
.next/static/chunks/25a52a6363a0e34a.js 12.41 KB
.next/static/chunks/4e2ee0f675df3734.js 14.57 KB
.next/static/chunks/4ef2011e5fc83625.js 7.66 KB
.next/static/chunks/bbb7b99903af4a19.js 12.83 KB
.next/static/chunks/4a38115ad626c02a.js 8.21 KB
.next/static/chunks/5e0f3f698316d2ed.js 12.77 KB
.next/static/chunks/3600fbabe8ad9c69.js 10.02 KB
.next/static/chunks/e718be35de9b2bbe.js 16.55 KB
.next/static/chunks/b83473ea70615a51.js 7.17 KB
.next/static/chunks/686e8d34ebdd5911.js 7.94 KB
.next/static/chunks/b0ce2a47ef648579.js 1.80 KB
.next/static/chunks/891803b696959206.js 5.62 KB
.next/static/chunks/d1f4b5ae1292b684.js 99.69 KB
.next/static/chunks/08b2c3d412cd961e.js 415.72 KB
.next/static/chunks/c81648fc68f8149c.js 1.59 KB
.next/static/chunks/c3208ccc45f488c8.js 99.69 KB
.next/static/chunks/190d50175bc5a781.js 32.22 KB
.next/static/chunks/de04b6b411bcccd2.js 788.08 KB
.next/static/chunks/d1c32bd947841a52.js 415.72 KB
.next/static/chunks/1669464b5616014e.js 99.69 KB
.next/static/chunks/2ae0b1b80283bdd9.js 32.22 KB
.next/static/chunks/6fb63490b9ae3904.js 788.08 KB
➖ Removed Assets (26)
Name Size
.next/static/chunks/cf9ab083c65f2944.js 9.88 KB
.next/static/chunks/5248ae55410a5d06.js 41.95 KB
.next/static/chunks/b54df6570868d110.js 64.69 KB
.next/static/chunks/fb87c41a19d7bbaf.js 184.13 KB
.next/static/chunks/7cfd5d627dc3af5d.js 45.33 KB
.next/static/chunks/bc90fa6021b52120.js 283.00 B
.next/static/chunks/558896212c31a6c5.js 31.79 KB
.next/static/chunks/3d486db5c4e81f21.js 24.71 KB
.next/static/chunks/5be69a63e0dd199e.js 100.41 KB
.next/static/chunks/c45a09c58ce55791.js 57.96 KB
.next/static/chunks/0a3981701cc22c30.js 412.26 KB
.next/static/chunks/7bc5bfbae1ad7c75.js 204.32 KB
.next/static/chunks/0b1e2cdfc2d5e8d7.js 67.76 KB
.next/static/chunks/cf3ae8386872b03f.js 24.88 KB
.next/static/chunks/68d5664504879476.js 22.82 KB
.next/static/chunks/ab5ee85dfc75ec81.js 67.76 KB
.next/static/chunks/004277efec02375f.js 8.50 KB
.next/static/chunks/c98da5ed2a266421.js 100.41 KB
.next/static/chunks/3a28d2ad04e48e39.js 10.31 KB
.next/static/chunks/1635b7ba2b63e95b.js 100.41 KB
.next/static/chunks/b50b31b328233e8d.js 17.83 KB
.next/static/chunks/e7589173b89939e9.js 781.86 KB
.next/static/chunks/8aac7e00673256b6.js 412.26 KB
.next/static/chunks/d58a1720bba76079.js 6.29 KB
.next/static/chunks/bbfc5ec97e7cd8fc.js 17.83 KB
.next/static/chunks/ede5dbd45e87101b.js 781.86 KB

@ovflowd
Copy link
Member Author

ovflowd commented Nov 24, 2025

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.51 MB
New Total Size 4.13 MB
Delta 626.91 KB (+17.42%)

Interesting that upgrading to Next.js 16 the bundle size increased? I wonder if that's SSR-based bundle size?

@ovflowd
Copy link
Member Author

ovflowd commented Nov 24, 2025

wdyt, cc @nodejs/web-infra?

@MattIPv4
Copy link
Member

Hmm, the homepage does appear to have gotten bigger. Loading the homepage on this branch loads 6.37 MB vs. 6.11 MB in production (woof, both of these are giant).

@avivkeller
Copy link
Member

avivkeller commented Nov 24, 2025

Details:
imageimage

@avivkeller
Copy link
Member

avivkeller commented Nov 24, 2025

The main difference I see is that this upgrade adds Babel to the bundle (https://github.com/nodejs/nodejs.org/pull/8218/files#diff-33ce070b849ec2220094ce84790e6978b0870aa1168826458888f280eae6489bR92):

Before:
image

After:
image

@ovflowd
Copy link
Member Author

ovflowd commented Nov 24, 2025

The main difference I see is that this upgrade adds Babel to the bundle (#8218 (files)):

Before: image

After: image

Isn't the babel plugin for react compiler? Should it got to the client-side?

@avivkeller
Copy link
Member

Isn't the babel plugin for react compiler?

Yes.

Should it got to the client-side?

The following client-side components are importing it:
image

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.

10 participants