Replace astro-icon with built-in icon system - #76
Draft
mvvmm wants to merge 2 commits into
Draft
Conversation
mvvmm
force-pushed
the
replace-astro-icon
branch
4 times, most recently
from
August 10, 2026 20:06
58c728f to
86b1d88
Compare
mvvmm
force-pushed
the
replace-astro-icon
branch
from
August 10, 2026 20:06
86b1d88 to
acfac20
Compare
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Replaces
astro-iconwith a built-in icon system owned by Nimbus. The motivation is the incremental build cache instability reported in cloudflare-docs PR #32438:astro-iconstamps a generatedlastModifiedtimestamp into thevirtual:astro-iconmodule on every build, which invalidates Astro's incremental build cache for thousands of pages. The package hasn't had a commit in 2+ years, so patching upstream isn't viable.What changed:
icon-virtual.ts) providingvirtual:nimbus/icons— auto-detects@iconify-json/*packages from the consumer'spackage.json, loads local SVGs fromsrc/icons/, processes them with@iconify/tools(cleanup, monochrome→currentColor, SVGO). Deliberately omitslastModifiedfrom the exported collection so the module content is deterministic across builds.Icon.astrocomponent (@cloudflare/nimbus-docs/components/Icon.astro) — drop-in replacement forastro-icon's<Icon>. Same API:name,size,width,height,is:inline,title,desc, plus all<svg>attributes. Default export.nimbus()via a newiconsoption (default on,falseto disable). Type injection forvirtual:nimbus/iconsinastro:config:done.import { Icon } from "astro-icon/components"toimport Icon from "@cloudflare/nimbus-docs/components/Icon.astro".astro-iconremoved fromastro.config.tsandpackage.jsonin bothnimbus-starter-sourceandapps/www.@iconify/tools@5(latest, no audit findings) changed the pnpm resolution tree, exposing a pre-existing bug wherecss-tree@3andcssousecreateRequire(import.meta.url)to load JSON files at runtime, breaking Vite's prerender bundling (csstree/csstree#314, svg/svgo#2149). Fixed by redirecting barecss-treeandcssoimports to their browser bundles (dist/csstree.esm,dist/csso.esm) which have JSON data inlined. The redirect uses both a ViteresolveIdhook (for Rollup) andoptimizeDeps.esbuildOptions.alias(for esbuild pre-bundling).Why Nimbus owns this:
@iconify/tools/@iconify/utils/@iconify/typesdeps are already the same packagesastro-icondepended on — no new transitive surface.Checklist
lgtm+on my issue or discussion), or I'm on the teampackages/nimbus-starter-source/, not thetemplatesbranchcreate-nimbus-docschangeset if the starter changed)pnpm typecheck,pnpm -r test, andpnpm templates:checkall green