nextjs - 💡(How to fix) Fix Regression: Next.js doesn't pass comments to SWC Plugin for server components [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86844Fetched 2026-04-08 02:08:56
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
referenced ×2cross-referenced ×1issue_type_added ×1labeled ×1

Error Message

  1. You'lee see an error, because server file is transformed

Root Cause

  1. build all the packages pnpm run build
  2. start next js dev server
  3. You'lee see an error, because server file is transformed

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri, 14 Nov 2025 06:54:20 +0000
  Available memory (MB): 31941
  Available CPU cores: 16
Binaries:
  Node: 25.2.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.23.0
Relevant Packages:
  next: 16.0.7 // Latest available version is detected (16.0.7).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/XantreDev/preact-signals/tree/8a4a425030b6b275c15e9fc8405de3f47aa260dc/apps/next-react-test

To Reproduce

  1. build all the packages pnpm run build
  2. start next js dev server
  3. You'lee see an error, because server file is transformed

Current vs. Expected behavior

Current behavior

Next.js passes incorrect comments to the swc plugin for server components. It works for client side components

Expected behavior

Next.js passes the correct comment to the swc plugin and everything works as it worked prior to version 16

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri, 14 Nov 2025 06:54:20 +0000
  Available memory (MB): 31941
  Available CPU cores: 16
Binaries:
  Node: 25.2.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.23.0
Relevant Packages:
  next: 16.0.7 // Latest available version is detected (16.0.7).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

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

SWC

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

next dev (local)

Additional context

I am maintainer of preact-signals library. It's wrapper around preact-signals and is shipped with an swc plugin. The plugin adds useSignals hook to any react component reading something with .value (in auto mode) or just every component in all mode

You can opt-in or opt-out from the transformation using /** @noUseSignals *///** @useSignals */ comments. It worked perfectly fine for client side and server side components. But after I upgraded my test app to the latest Next version it stopped working for client side components

It isn't an issue of swc itself, it handles it with no issues input, output

extent analysis

TL;DR

  • The issue can be addressed by investigating and adjusting the SWC plugin configuration or the Next.js setup to correctly handle comments for server components.

Guidance

  • Verify that the /** @noUseSignals */ and /** @useSignals */ comments are correctly applied to the components and check if they are being overridden or ignored by Next.js.
  • Check the SWC plugin configuration to ensure it is set up to handle server components correctly, as it works fine for client-side components.
  • Investigate any changes in Next.js version 16 that might affect how comments are passed to the SWC plugin for server components.
  • Test the SWC plugin with a minimal example to isolate if the issue is specific to the preact-signals library or a more general problem with Next.js and SWC.

Example

No specific code example can be provided without more details on the exact configuration and implementation.

Notes

The issue seems to be related to how Next.js handles comments for server components when using the SWC plugin, which might have changed in version 16. Without more specific details on the configuration and implementation, it's challenging to provide a precise fix.

Recommendation

  • Apply workaround: Adjust the SWC plugin configuration or the Next.js setup to correctly handle comments for server components, as the issue seems to be related to the interaction between Next.js and the SWC plugin.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Next.js passes the correct comment to the swc plugin and everything works as it worked prior to version 16

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING