vercel / vercel/next.js

Unexpected References to Server Actions, Turbopack, Hot Reload and DevTools in Production Export Build

Open
#76,198 1 comment 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linear: next Output
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/daniilpanichevornament/next-export

To Reproduce
  1. Configure Next.js with the module: export option.
  2. Run the production build.
  3. Inspect the output source files for references to server actions, turbopack, hot reload, and devtools

Additional Evidence:

I have identified these issues in the built files:

Current vs. Expected behavior

Expected Behavior:

A production export build should include only the necessary static content without any references to development or server-only features, resulting in an optimized bundle.

Actual Behavior:

The build output contains references to server actions and various development tools, leading to a larger bundle size and unnecessary traffic overhead.

Impact:

This issue might be affecting performance in production, especially under high load, due to the increased bundle size and the overhead of shipping unused code.

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home Single Language
  Available memory (MB): 16111
  Available CPU cores: 16
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.1.7 // Latest available version is detected (15.1.7).
  eslint-config-next: 15.1.7
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: export
Which area(s) are affected? (Select all that apply)

Performance, Turbopack, Server Actions, Output

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

I assume that the static export should be completely free of code that isn't used in production.
Any insights on whether this is expected behavior or if there's a configuration option to remove these references would be greatly appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked next-export reproduction, run next build with output: export, and inspect the generated .next/static/chunks/main-b45a38056bc69915.js and 517-0d7e8c6ba2452810.js files. Compare the reported references with the expected static-only output and trace which build stage includes them. Done means establishing whether this is intentional behavior or a reproducible export-build defect.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
build-system, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.