From 4d8d2de6ad34540ef09b05a9b4cfb4e23e093d20 Mon Sep 17 00:00:00 2001 From: Akuria <46207353+Akur1a@users.noreply.github.com> Date: Sat, 16 May 2026 10:43:47 +0800 Subject: [PATCH] fix: guard svg icon loading during docs SSR (#7912) --- .changeset/small-moons-hunt.md | 5 +++++ packages/icons/src/svg/load.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/small-moons-hunt.md diff --git a/.changeset/small-moons-hunt.md b/.changeset/small-moons-hunt.md new file mode 100644 index 000000000..ab3820103 --- /dev/null +++ b/.changeset/small-moons-hunt.md @@ -0,0 +1,5 @@ +--- +"@vben/icons": patch +--- + +fix: guard svg icon loading during docs SSR diff --git a/packages/icons/src/svg/load.ts b/packages/icons/src/svg/load.ts index c42dd50d2..b21869ba3 100644 --- a/packages/icons/src/svg/load.ts +++ b/packages/icons/src/svg/load.ts @@ -53,6 +53,14 @@ function parseSvg(svgData: string): IconifyIconStructure { * */ async function loadSvgIcons() { + if ( + typeof DOMParser === 'undefined' || + typeof Node === 'undefined' || + typeof XMLSerializer === 'undefined' + ) { + return; + } + const svgEagers = import.meta.glob('./icons/**', { eager: true, query: '?raw',