nuxt/icon

@nuxt/icon greatly increases build prerender time vs nuxt-icon

Closed this issue · 0 comments

Hi,

We just replaced nuxt-icon with the new @nuxt/icon and our build time went from around 150 seconds to 450 seconds.
The increased delay appears to be from the prerendering phase, please see differences below.

Before:

(...)
Server built in 20910ms
[nitro] ℹ Initializing prerenderer
[nitro] ℹ Prerendering 1 routes
[nitro]   ├─ /api/_content/cache.1720712707379.json (2480ms)
[nitro] ℹ Prerendered 1 routes in 37.293 seconds
[nitro] ✔ Generated public .output/public
[nitro] ℹ Building Nuxt Nitro server (preset: node-server)
[nitro] ✔ Nuxt Nitro server built
  ├─ .output/server/chunks/_/empty.mjs (161 B) (151 B gzip)
  ├─ .output/server/chunks/_/empty.mjs.map (173 B) (145 B gzip)
  ├─ .output/server/chunks/_/error-500.mjs (4.83 kB) (2.05 kB gzip)
  ├─ .output/server/chunks/_/error-500.mjs.map (190 B) (157 B gzip)
  ├─ .output/server/chunks/_/node.mjs (176 B) (156 B gzip)
  ├─ .output/server/chunks/_/node.mjs.map (216 B) (170 B gzip)
  ├─ .output/server/chunks/_/node2.mjs (169 B) (152 B gzip)
  ├─ .output/server/chunks/_/node2.mjs.map (210 B) (167 B gzip)
  ├─ .output/server/chunks/_/pure.mjs (2.06 kB) (903 B gzip)
  ├─ .output/server/chunks/_/pure.mjs.map (178 B) (150 B gzip)
  ├─ .output/server/chunks/_/renderer.mjs (14.8 kB) (4.32 kB gzip)
  ├─ .output/server/chunks/_/renderer.mjs.map (1.37 kB) (305 B gzip)
(...)

After:

(...)
Server built in 21261ms
[nitro] ℹ Initializing prerenderer
[nitro] ℹ Prerendering 1 routes
[nitro]   ├─ /api/_content/cache.1721052129200.json (3168ms)
[nitro] ℹ Prerendered 1 routes in 204.492 seconds
[nitro] ✔ Generated public .output/public
[nitro] ℹ Building Nuxt Nitro server (preset: node-server)
[nitro] ✔ Nuxt Nitro server built
  ├─ .output/server/chunks/_/empty.mjs (161 B) (151 B gzip)
  ├─ .output/server/chunks/_/empty.mjs.map (173 B) (145 B gzip)
  ├─ .output/server/chunks/_/error-500.mjs (4.83 kB) (2.05 kB gzip)
  ├─ .output/server/chunks/_/error-500.mjs.map (190 B) (157 B gzip)
  ├─ .output/server/chunks/_/icons.mjs (983 kB) (251 kB gzip)
  ├─ .output/server/chunks/_/icons.mjs.map (7.35 kB) (118 B gzip)
  ├─ .output/server/chunks/_/icons2.mjs (7.25 MB) (2.65 MB gzip)
  ├─ .output/server/chunks/_/icons2.mjs.map (8.74 kB) (121 B gzip)
  ├─ .output/server/chunks/_/icons3.mjs (893 kB) (218 kB gzip)
  ├─ .output/server/chunks/_/icons3.mjs.map (8.83 kB) (121 B gzip)
  ├─ .output/server/chunks/_/icons4.mjs (1.76 MB) (275 kB gzip)
  ├─ .output/server/chunks/_/icons4.mjs.map (16.9 kB) (129 B gzip)
  ├─ .output/server/chunks/_/index_bg.mjs (1.06 MB) (435 kB gzip)
  ├─ .output/server/chunks/_/index_bg.mjs.map (110 B) (103 B gzip)
  ├─ .output/server/chunks/_/node.mjs (176 B) (156 B gzip)
  ├─ .output/server/chunks/_/node.mjs.map (216 B) (170 B gzip)
  ├─ .output/server/chunks/_/node2.mjs (169 B) (152 B gzip)
  ├─ .output/server/chunks/_/node2.mjs.map (210 B) (167 B gzip)
  ├─ .output/server/chunks/_/pure.mjs (2.06 kB) (903 B gzip)
  ├─ .output/server/chunks/_/pure.mjs.map (178 B) (150 B gzip)
  ├─ .output/server/chunks/_/renderer.mjs (14.8 kB) (4.3 kB gzip)
  ├─ .output/server/chunks/_/renderer.mjs.map (1.27 kB) (287 B gzip)
(...)

Note the very large IconsX.mjs files with the new module (I'm assuming it's caching the icons locally maybe?)

But what we find very strange is that the delay is apparently when pre-rendering the endpoint from nuxt-content that went from 37 to 204 seconds (!)

Any ideas why this can be happening or how we can speed this up?

Thank you, cheers.