fix: guard svg icon loading during docs SSR (#7912)

master^2
Akuria 2026-05-16 10:43:47 +08:00 committed by GitHub
parent 294700a247
commit 4d8d2de6ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"@vben/icons": patch
---
fix: guard svg icon loading during docs SSR

View File

@ -53,6 +53,14 @@ function parseSvg(svgData: string): IconifyIconStructure {
* <Icon icon="svg:avatar"></Icon>
*/
async function loadSvgIcons() {
if (
typeof DOMParser === 'undefined' ||
typeof Node === 'undefined' ||
typeof XMLSerializer === 'undefined'
) {
return;
}
const svgEagers = import.meta.glob('./icons/**', {
eager: true,
query: '?raw',