Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daniilpanichevornament opened this issue Feb 19, 2025 · 1 comment
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Output Related to the the output configuration option.

Comments

@daniilpanichevornament
Copy link

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.

@github-actions github-actions bot added Output Related to the the output configuration option. Performance Anything with regards to Next.js performance. Server Actions Related to Server Actions. Turbopack Related to Turbopack with Next.js. labels Feb 19, 2025
@mischnic mischnic removed the Turbopack Related to Turbopack with Next.js. label Feb 19, 2025
gaojude added a commit that referenced this issue Feb 19, 2025
Follow up to #54078, we wouldn't
want HMR related code in production bundle. Relates to
#76198 but doesn't solve that
completely.

----
<table>
  <tr>
<td><img
src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/rKSEEwxbNzdFs9t0yyxN/5ed4dfeb-5bc6-4e14-a1e8-efef2d0e0066.png"
width="300"/></td>
<td><img
src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/rKSEEwxbNzdFs9t0yyxN/38e382b2-718d-4a09-b55a-6df8b4865614.png"
width="300"/></td>
  </tr>
  <tr>
<td colspan="2" style="text-align: center;">Size reduced from 122KB to
119KB for a trivial app router application.</td>
  </tr>
</table>
@samcx samcx added linear: next Confirmed issue that is tracked by the Next.js team. and removed Performance Anything with regards to Next.js performance. Server Actions Related to Server Actions. labels Feb 20, 2025
@samcx
Copy link
Member

samcx commented Feb 20, 2025

@daniilpanichevornament Thank you for submitting an issue!

Looks like we are already taking a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Output Related to the the output configuration option.
Projects
None yet
Development

No branches or pull requests

3 participants