Skip to content

Deployment & SSR bundles

Astro Iconset works with any Astro deployment target. This page covers how rendering mode affects icon resolution and how to keep server bundles small.

Astro supports three rendering modes. Here is how Astro Iconset behaves in each:

ModeHow icons are resolvedBundle concern
Static (output: 'static')All icons resolved at build time, embedded in HTMLNone — no server bundle
Hybrid (output: 'hybrid')Pre-rendered routes resolved at build time; server routes resolved at request timeOnly server routes need include
Server (output: 'server')All icons resolved at request time from Iconify data in server bundleConfigure include to avoid shipping entire sets

For a fully static Astro site, icon resolution happens at build time. Every <Icon> becomes an SVG in your HTML output. No include configuration is needed.

Terminal window
npm run build

The dist/ folder contains everything — no server JavaScript involved.

When using an SSR adapter, Iconify icon data from @iconify-json/* packages is included in the server JavaScript bundle by default. If you install large sets (e.g. @iconify-json/mdi with ~7,000 icons), all of them are bundled unless you restrict them with include.

Terminal window
# Vercel
npm install @astrojs/vercel
# Netlify
npm install @astrojs/netlify
# Node.js server
npm install @astrojs/node

All routes are server-rendered. Use include to limit which Iconify icons ship in the bundle:

astro.config.mjs
import { defineConfig } from "astro/config";
import vercel from "@astrojs/vercel/serverless";
import icon from "astro-iconset";
export default defineConfig({
output: "server",
adapter: vercel(),
integrations: [
icon({
include: {
// Only ship the icons your server routes actually render
mdi: ["account", "home", "menu", "close"],
// To include a whole set (can be large):
// ri: ["*"],
},
}),
],
});

Pre-rendered (static) routes resolve icons at build time. Only server-rendered routes need icons bundled. Configure include for the icons used on those routes:

astro.config.mjs
import { defineConfig } from "astro/config";
import node from "@astrojs/node";
import icon from "astro-iconset";
export default defineConfig({
output: "hybrid",
adapter: node({ mode: "standalone" }),
integrations: [
icon({
include: {
mdi: ["account", "logout"],
},
}),
],
});

Pages that use export const prerender = true are built statically — their icons do not need to be in include. Only the dynamic (non-prerendered) routes need it.

Icons work in dev but are missing in production

Section titled “Icons work in dev but are missing in production”

The dev server resolves Iconify icons on demand from disk. The production server only serves what was bundled at build time via include. If an icon appears in dev but disappears in production, add it to the include map.

astro.config.mjs
icon({
include: {
mdi: ["account"],
mdi: ["account", "settings"], // add the missing icon
},
}),