Skip to content

fix(dev): silence icon SSR failures and stale optimizeDeps warning - #125

Merged
naitokosuke merged 1 commit into
mainfrom
fix/dev-warnings
Aug 13, 2026
Merged

fix(dev): silence icon SSR failures and stale optimizeDeps warning#125
naitokosuke merged 1 commit into
mainfrom
fix/dev-warnings

Conversation

@naitokosuke

@naitokosuke naitokosuke commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes two kinds of warnings that flooded the dev server.

1. [Icon] failed to load icon mdi:github / lucide:rss

Root cause (upstream, already reported as nuxt/icon#518, fix pending as nuxt/icon#527):

  • @nuxt/icon's SSR plugin calls _api.setFetch($fetch.native). Up to 2.2.3 the $fetch here was Nuxt's global ofetch instance, whose .native is the internal-capable local fetch — this worked. Since 2.4.0 the plugin switched to useRequestFetch(), which during SSR returns Nitro's event.$fetch — a bare function with no .native property (nitropack 2.13.4 runtime/internal/app.mjs)
  • As a result it becomes setFetch(undefined), and @iconify/vue's send() aborts every icon request via if (!fetchModule) callback("abort", 424) — that is what the warnings are (with the real damage that icons never make it into the SSR HTML)
  • For this repo the trigger was the @nuxt/icon 2.2.3 → 2.5.0 bump in chore(deps): update dependencies within current major #118

Fix:

  • Add a server plugin app/plugins/icon-ssr-fetch.server.ts that routes relative URLs through Nuxt's $fetch (capable of internal calls). Since @nuxt/icon puts @iconify/vue into vite.resolve.dedupe, the patch lands on the same _api singleton
  • Also install the lucide collection in use (5 icons) locally as @iconify-json/lucide, bundling it server-side like mdi (this also fixes the 6x lucide:rss fetch failures that appeared on every build)

2. [NUXT_B7002] vite.optimizeDeps.include: @nuxtjs/mdc > extend

Root cause (initial explanation corrected):

  • unified 11 no longer depends on extendwrong. unified@11.0.5 still depends on extend ^3.0.0
  • Correct version: the @nuxtjs/mdc > extend entry asks Vite to resolve extend from @nuxtjs/mdc's own package context, but extend is a dependency of unified, not a declared dependency of mdc itself, so pnpm's isolated node_modules cannot resolve it (hoisted npm/yarn layouts resolve it by accident, which is why upstream does not notice; long-standing report: Without shamefully-hoist, it fails to resolve dependency present in 'optimizeDeps.include' nuxt-content/mdc#174). Nuxt 4.5's B7002 warning made it visible
  • The entry still exists in the latest @nuxtjs/mdc 0.23.1 (2026-08-10) — unfixed upstream

Fix: add extend to root devDependencies. The root node_modules is on the resolution walk-up path from pnpm's store directories, so the entry becomes resolvable (warning confirmed gone)

Verification

  • Dev server starts with neither warning
  • pnpm build with zero icon warnings (previously 6x lucide:rss) and 11 OG images generated
  • pnpm lint / tsc (both app and node projects) pass

Notes

🤖 Generated with Claude Code

dev サーバーの 2 種類の警告を解消する:

1. "[Icon] failed to load icon mdi:github / lucide:rss"
   - nuxt 4.5 では @nuxt/icon の SSR が使う useRequestFetch().native が
     内部呼び出し不能な素の fetch になり、相対 URL (/api/_nuxt_icon/...) の
     取得が全アイコンで失敗していた(upstream 起因)
   - 相対 URL だけ Nuxt の $fetch 経由に差し替える server plugin を追加
   - あわせて使用中の lucide コレクションを @iconify-json/lucide として
     ローカルインストールし、mdi と同じくサーバーバンドルに含める
     (build 時に毎回出ていた lucide:rss の取得失敗 ×6 も解消)

2. "[NUXT_B7002] vite.optimizeDeps.include: @nuxtjs/mdc > extend"
   - @nuxtjs/mdc 0.22 が optimizeDeps に "extend" (unified の旧 CJS 依存) を
     追加し続けているが、unified 11 は extend に依存しないため解決不能だった
   - 他の remark 系と同様に extend を devDependencies に追加して解決可能にする

lint / build / tsc 成功、build の icon 警告ゼロ、OG 画像生成も正常を確認。
@nuxt/icon 2.5.0 / @nuxtjs/mdc 0.22.2 の修正版が出たら plugin と extend は
削除できる。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview Aug 13, 2026 5:14pm

@naitokosuke
naitokosuke merged commit 0f1f282 into main Aug 13, 2026
3 checks passed
@naitokosuke
naitokosuke deleted the fix/dev-warnings branch August 13, 2026 17:19
@naitokosuke naitokosuke changed the title fix(dev): icon の SSR 取得失敗と optimizeDeps 警告を解消 fix(dev): silence icon SSR failures and stale optimizeDeps warning Aug 13, 2026
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.

1 participant