Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A missing 'use client' boundary can undermine the code-splitting a developer expects from next/dynamic. Daniel Pertu reports that a game route in his Next.js app loaded about 2.6 MB of JavaScript despite using a dynamic registry for 165 games. His diagnosis was that the registry was evaluated from a Server Component; his fix moved game selection into a small Client Component. The figures and explanation describe Pertu’s app, not a general Next.js benchmark or a reproduced test.

What happened in Pertu’s Next.js app

Pertu describes a site with 165 practice games, each implemented as a React component with its own engine and state; some also used canvas. A registry mapped each game ID to a next/dynamic import. Yet the /games/<id> route had a first load of about 2.6 MB of JavaScript, according to his article.

In Pertu’s account, the registry had no 'use client' directive and was imported by a Server Component page. Because the registry selected among game components at runtime, he says the build had to account for all of those client components, and the dynamic imports did not give the intended per-game isolation. That is his explanation of this application’s module graph and build—not a rule that applies identically to every Next.js version, bundler, or project.

Why the client boundary matters

Next.js defines 'use client' as a directive that marks a Client Component entry point and establishes a boundary between the server and client module graphs. It is needed in files that serve as entry points rendered directly from Server Components, not in every component file. Imports below a client entry point become part of the client bundle, so the boundary should be kept focused. See the Next.js 'use client' reference and its Server and Client Components guide.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Marvel vs. Capcom Fighting Collection: Arcade Classics - Nintendo Switch
  • Experience your Favorite MARVEL vs. CAPCOM classics All in One – Enjoy 7 of your favorite classic titles that helped shaped the MARVEL vs. CAPCOM universe both single player and online.
  • Enjoy Enhanced Features Added to the Classic Collection – To enhance your playability experience, we incorporated the favorite added features from Capcom Fighting Collection including gallery mode, quick save, training mode for all fighting titles, and the high score challenge. Beginners and first timers into the franchise are also welcome to play through adjusted settings and execution of one-button specials!
  • Play with Friends Worldwide through Online Compatibility – This collection also includes rollback net code for a smooth and enjoyable experience online. Play casually or competitively through casual, ranked, or custom matches using rules of your choosing!

This distinction matters because a file containing React components is not automatically a client entry point. Where a registry is evaluated determines which module graph it belongs to. Meanwhile, next/dynamic is a mechanism for lazy-loading Client Components and imported libraries; it can reduce the JavaScript needed for a route, but it does not guarantee a particular chunk layout for every runtime-selected registry. Next.js describes the feature in its lazy-loading guide.

How Pertu changed the design

Pertu’s proposed fix was to move the registry into the client module graph by adding 'use client', then place the dynamic lookup in a small GameRunner Client Component that receives a game ID. The Server Component page can still resolve the requested game, perform access and play-budget checks, and create metadata before rendering that client entry point.

Rank #2
Sale
Star Wars: Heritage Pack - Nintendo Switch
  • The following games are included in the cartridge: STAR WARS Jedi Knight: Jedi Academy (3.6 GB)
  • STAR WARS Jedi Knight II: Jedi Outcast (1.1 GB)
  • STAR WARS Episode I Racer (254 MB)
  • STAR WARS Republic Commando (2.5 GB)
  • STAR WARS: The Force Unleashed (3.4 GB)

The server passes the selected ID; the client looks up and loads the interactive implementation. This means the server cannot call getGameComponent from that client-side registry. As Pertu puts it: “The consequence for callers: a Server Component can no longer call getGameComponent. Pass the game id to GameRunner instead.”

This split keeps entitlement decisions and other server-only work on the server while handing interactive component resolution to the client. Props passed from a Server Component to a Client Component need to be serializable, as the Next.js component guide explains. The appropriate boundary depends on an app’s data and security model; moving a lookup to the client should not move authorization decisions with it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
FINAL FANTASY I-VI Collection Anniversary Edition - 2024 (NSW)
  • The games that inspired a generation come to life once more, in the ultimate 2D pixel remaster!
  • These games are newly developed remaster editions based on the original titles. Some of the changes and additional elements found in other remakes of these games are not included.
  • The Anniversary Edition includes a pixel character sticker sheet.
  • Universally updated 2D pixel graphics, including the iconic FINAL FANTASY character designs created by Kazuko Shibuya, the original artist and current collaborator.
  • Beautifully rearranged soundtrack in a faithful FINAL FANTASY style, overseen by original composer Nobuo Uematsu.

How to check whether a route loads too much JavaScript

  1. Build the production app. Run next build and inspect the route information and bundle measurements in the build output or the bundle analyzer configured for the project. Next.js documents next build as producing an optimized production build with route information in its CLI reference. The exact output columns and available tooling vary by release and build mode.
  2. Inspect browser requests on the affected route. Open browser developer tools, choose the Network panel, load the route, and review its JavaScript requests. For a lazy-loaded game, check whether the route’s own chunks load first and whether a chunk for the selected game is requested when the game runner mounts. Pertu describes this check for his Cogniprep example; it is a reported procedure, not an independent test of the app.
  3. Compare the payload with the feature used. Consider whether the requested code matches what the route actually needs. A large increase after an unrelated feature is added can be a useful clue, but it does not by itself prove a client-boundary problem.

Pertu’s takeaway was that “next/dynamic is not a promise, it is a request.” In practical terms, treat dynamic loading as an instruction to the framework and verify the production build and browser requests to see what your application actually sends.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the reported numbers do—and do not—show

The 165 games and approximately 2.6 MB of first-load JavaScript are Pertu’s app-specific figures. His article does not establish a measured post-fix size or a percentage improvement, and the figures are not a controlled before-and-after result or a benchmark for Next.js applications generally. Framework behavior and documentation can also change between releases; check the guidance for your Next.js version and confirm the result in your own production build.

Quick Recap

SaleBestseller No. 2
Star Wars: Heritage Pack - Nintendo Switch
Star Wars: Heritage Pack - Nintendo Switch
STAR WARS Jedi Knight II: Jedi Outcast (1.1 GB); STAR WARS Episode I Racer (254 MB); STAR WARS Republic Commando (2.5 GB)
$35.47
Bestseller No. 3
FINAL FANTASY I-VI Collection Anniversary Edition - 2024 (NSW)
FINAL FANTASY I-VI Collection Anniversary Edition - 2024 (NSW)
The Anniversary Edition includes a pixel character sticker sheet.; Improved gameplay, including modernized UI, auto-battle options, and more!
$45.99
Rank #4
Sale
Mega Man Star Force Legacy Collection - PlayStation 5
  • The Mega Man Star Force Legacy Collection includes Mega Man Star Force Pegasus, Mega Man Star Force Leo, Mega Man Star Force Dragon, Mega Man Star Force 2 Zerker x Ninja, Mega Man Star Force 2 Zerker x Saurian, Mega Man Star Force 3 Black Ace & Mega Man Star Force 3 Red Joker.
  • Browse over 1,000 pieces of official artwork, including rare concept illustrations. You can also rock out to music from all three Mega Man Star Force titles plus newly arranged tracks, with select tracks that can be set as in-game background music.
  • Customize gameplay by increasing your Mega Buster power, adjusting encounter rates, and playing through Casual for easy play or Ranked Matches for global competition.
  • Optional high-resolution filters allow you to enjoy smoother visuals or toggle them off at any time to experience the classic look.
  • Rare bonus cards previously obtainable only through events or merchandise are included. You can also combine them with cards earned during gameplay to build even more powerful decks (some bonus cards are not included).

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.